← 返回 meta 的题目列表Maze Path Finding (classic)
类型:online_judge
Given a 2D maze grid grid where:
0 is an empty cell
1 is a wall
Starting from (sr, sc), determine whether you can reach (tr, tc) using 4-directional moves (up/down/left/right), moving to adjacent cells.
Input:
First line: m n
Next m lines: n integers (0/1) separated by spaces
Next line: sr sc
Next line: tr tc
Output:
Print true if reachable, else false.
Constraints:
1 <= m, n <= 200
Example: Input:
3 4
0 0 1 0
0 0 0 0
1 0 1 0
0 0
1 3
Output:
true
Example
Input
3 4
0 0 1 0
0 0 0 0
1 0 1 0
0 0
1 3
Output
true