| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 12 | 9 | 8 | 72.727% |
Carl the ant is back! After traveling around some pyramids, Carl has decided to study some algorithms and has invented a novel algorithm for solving grid mazes. It works as follows:
Carl wants to know if this algorithm works. Help him check!
The first line of input contains two integers, $r$ and $c$ $(1 \le r, c \le 50),ドル indicating the size (rows, columns) of the maze. The cell at $(1,1)$ is the top left corner of the maze.
The next line of input contains two integers, $i_{start}$ and $j_{start}$ $(1 \le i_{start} \le r, 1 \le j_{start} \le c),ドル the starting location for Carl in row $i_{start},ドル column $j_{start}$.
The next line of input contains two integers, $i_{end}$ and $j_{end}$ $(1 \le i_{end} \le r, 1 \le j_{end} \le c),ドル the desired ending location for Carl in row $i_{end},ドル column $j_{end}$. It is guaranteed the starting location and desired ending location for Carl are different.
Each of the next $r$ lines contains a string of $c$ characters, consisting only of 0 or 1. If the character is 1, then that square has an obstacle in it and cannot be traversed, otherwise it is empty. It is guaranteed that Carl’s starting location and desired ending location are empty.
Output a single integer, which is 1ドル$ if it is possible for Carl to get from the starting location to the ending location, and 0ドル$ otherwise.
4 5 1 1 4 5 00111 10100 10111 10000
1
3 3 1 1 3 3 001 001 110
0
ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2025 D번
University > MIT > The MIT Programming Contest > 2025-26 > MIT Team Contest 1 D번