|
|||||||||||||||||||
|
SPOJ time: 2012-02-09 01:52:48 |
MuseumProblem code: HS09MUS
After the last robbery in the Museum of Natural History, a modern anti-theft alarm has been installed. Many people have volunteered to test the system, but so far none of them have managed to break it. Now, the management of the museum has changed their approach and they would like someone to find the weakest points of the system. They have asked you for help. Write a program which will find a route to the main exhibit such that the probability of being detected is the smallest possible. To do so, you have been given a map of the exhibition room.
InputThenput description is almost the same as in the Mowing Optimization problem. First, we are given the starting point (x1, y1) - the potential thief is located at (x1, y1) (x1+1, y1) (x1+1, y1+1) (x1, y1+1), and the end point (x2, y2) Next, there is given a description of the border of the room which consists of: an integer k – the number of line segments (4 <= k <= 1000), then there come the descriptions of successive segments of the boundary, expressed by the coordinates of one distinguished point (a, b), followed by k vectors[ ai, bi] separated by commas, describing the i -th segment of the border when traversed in the clockwise direction (for each i , 1<= i <= k we have 0 < ai2 +bi2 < 106 and aibi=0). Then there is given n - the number of other exhibits in the room and then there are n descriptions of every exhibit (i.e., the coordinates of the starting point and of the outline, as above). Then there is given d – the number of sensors, followed by d descriptions of each sensor (x, y) r, where r is the range of detector. Position is determined in the same way as the starting and ending point - sensor is placed in the centre of a tile. You can assume that each outline is a closed line, in which no two segments cross, nonadjacent elements do not touch themselves, the total number of tiles to be cut does not exceed 10000, and the whole room fits into a 1000x1000 square. OutputFirst, output a single integer, describing the number of steps to be made, followed by a sequence of letters describing the successive steps. After all the steps have been completed, the thief should be located at the main exhibit point. If the thief will step onto another exhibit or a temperature sensor, your solution will be deemed incorrect. Likewise, your solution will be incorrect if at any time the theft will be located outside the room. If more than one possible route exists, you should output any one of them. Example description
Example 1
Input:
(0, 0) (3, 3)
Example 2
Input: (0, 0) (2, 5) ScoringFor solving this problem you will score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||