|
|||
EscapeFaust and Mephistopheles have gone into the dungeon to free Gretchen. After rushing past the guards at the gate and winding their way through the dungeons, they arrive at Gretchen's cell. On the wall beside the cell is a detailed map of the dungeon, including all hallways and cells and the positions of every guard. Using this map, they must plot a path to return to the entrance and escape. Input SpecificationLocations on the map are represented by integers. Intersections range from 1 to 5000, cells from 5001 to 10000, and the entrance/exit is 0.
The input starts with two numbers in a line: the number of intersections and the number of
cells. This is followed by a line containing Gretchen's cell number, G. Then comes
the list of hallways that are not yet guarded (no guard at either end) as two integers on
each line. The list ends with the pair “ Output SpecificationThe output contains the list of locations to be visited by Faust and Mephistopheles during their escape, as one integer per line, starting with Gretchen's cell and ending with 0. There will always be at least one valid route, any of which will be accepted. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |