numbers, of either 0
or 1
. 0
indicates the rat can move there, while a 1
indicates there is a wall and the rat cannot move there or pass through there. At the end of the maze, is a piece of cheese. The rat really loves cheese, help him get to the cheese!
Constraints
Input Specification
The first line contains an integer, , the size of the maze.
An size grid, with 0
and 1
s.
Output Specification
Print out either yes
or no
, if the rat can reach the end of the maze or not.
Sample Input
4
0 0 1 1
0 0 0 1
0 0 1 0
0 1 0 0
Sample Output
no
Comments
For anyone wondering, the starting square will not contain a 1
Shouldn't this be labelled as graph theory?