You are about to cross an
Determine whether it is possible to cross the field or not if you start at the top left corner, square
Input Specification
The first line of input will contain 2 integers:
The next
Output Specification
On a single line, output yes
if you can cross the field; otherwise, output no
.
Constraints
Test Case Batch | Marks | Constraints |
---|---|---|
1 [5 + 10 cases] | 80 | |
2 [2 + 12 cases] | 20 |
Sample Input
4 3
3 6 4 9
7 1 2 3
7 7 2 2
7 7 1 5
Sample Output
yes
Explanation for Sample Output
From the top left square, you can go right, right, down, down, right, down to reach the bottom right square.
Comments
Does diagnol count as going to an adjacent square?
No
On Batch 1 Case 4 and Batch 2 Case 1, I keep getting an Invalid Return. I have reviewed my code and I can't find the problem. Could you give me a hint as to what's wrong with my program? Am I forgetting a certain edge case? Thanks
Put this at the top of your code.
Your code is exceeding python's built in recursion limit, which is 999.
Thanks!