|
|||
Magical ProtectionHere's the rundown. Harry is good, but he's just a kid, and his magic is weak. Voldemort is evil, and his magic is strong. Dumbledore is good, and his magic is the most powerful of all. Harry, Voldemort, and Dumbledore are in a square grid maze. Voldemort wants to move from his location to Harry's location. If he makes it to Harry's location, Voldemort can kill Harry. BUT if Voldemort ever visits Dumbledore's location or one of the up to eight squares adjoining Dumbledore's location (horizontally, vertically, or diagonally), Dumbledore will subdue Voldemort before Voldemort can kill Harry. Voldemort can move horizontally and vertically (but not diagonally). Harry and Dumbledore cannot move at all. Given an input maze, you are to print out whether Voldemort can bypass Dumbledore to get to Harry. Voldemort is not an idiot; he will not go past Dumbledore if it is possible to get to Harry another way. Input Specification
The input will consist of series of mazes. Each maze will consist of r lines, each
containing c characters. r and c will be inclusively between 2 and
20. Most of the characters will be either ' Output Specification
The output cases are to appear in the same order in which they appear in the input. For each
maze, you are to print either “ Sample Input
Output for Sample Input
Original Problem |
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |