#C1191. Maze Escape
Maze Escape
Maze Escape
Given an ( m \times n ) maze represented as a grid of integers, where 0 indicates an open cell and 1 indicates a wall, determine whether there is a valid path from the top-left corner to the bottom-right corner. Movement is allowed in the four primary directions: up, down, left, and right. Formally, for a maze ( A ), check if there exists a sequence of moves starting at ( A[0][0] ) and ending at ( A[m-1][n-1] ) such that every visited cell ( A[i][j] ) has a value of 0.
inputFormat
The first line contains two space-separated integers ( m ) and ( n ), representing the number of rows and columns. Following this, there are ( m ) lines with ( n ) space-separated integers (each either 0 or 1) representing the maze.
outputFormat
Output a single line: print "True" if there exists a valid path from the top-left cell to the bottom-right cell, otherwise print "False".## sample
4 5
0 1 0 0 1
0 0 0 1 0
1 1 0 1 0
1 0 0 0 0
True
</p>