# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28187 | 시.공.조.아. (#71) | The City and The Bitcoin (FXCUP2_city) | C11 | 9 ms | 1820 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
int map[300][300], visited[300][300], N, M;
void DFS(int x, int y) {
visited[x][y] = 1;
if (map[x + 1][y] == 1 && visited[x + 1][y] == 0 && x + 1 <= M)
DFS(x + 1, y);
if (map[x][y + 1] == 1 && visited[x][y + 1] == 0 && y + 1 <= N)
DFS(x, y + 1);
}
int main() {
int i, j;
scanf("%d %d", &N, &M);
for (i = 0; i < M; i++) {
for (j = 0; j < N; j++)
scanf("%d", &map[i][j]);
}
for (i = 0; i < M; i++) {
for (j = 0; j < N; j++) {
if (map[i][j] == 1) visited[i][j] = 0;
else visited[i][j] = -1;
}
}
DFS(0, 0);
if (visited[M - 1][N - 1] == 1) printf("Yes");
else printf("No");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |