Problem A
Jack and Jill
Ever since the incident on the hill, Jack and Jill dislike each other and wish to remain as distant as possible. Jack and Jill must attend school each day; Jack attends a boys’ school while Jill attends a girls’ school. Both schools start at the same time. You have been retained by their lawyers to arrange routes and a schedule that Jack and Jill will adhere to so as to maximize the closest straight-line distance between them at any time during their trip to school.
Jack and Jill live in a town laid out as an
Input
Input will consist of several test cases (at most 30). Each
test case will consist of
Output
For each input case you should give three lines of output containing:
-
The closest that Jack and Jill come during the schedule (to 2 decimal places)
-
Jack’s route
-
Jill’s route.
Each route is a sequence of directions that Jack or Jill
should follow for each minute from the start time until
arriving at school. Each direction is one of ’N’, ’S’, ’E’, or ’W’. If
several pairs of routes are possible, any one with at most
Sample Input 1 | Sample Output 1 |
---|---|
10 .......... ...H...... .**...s... .**....... .**....... .**....... .**....... .**....... ...S..h..* .......... 0 |
6.71 WWWSSSSSSSEEE NEEENNNNNWWW |