# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28090 | 2017-07-15T10:26:28 Z | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(#1199, suhgyuho_william) | The City and The Bitcoin (FXCUP2_city) | C++14 | 16 ms | 2464 KB |
#include <bits/stdc++.h> using namespace std; int N,M; int a[302][302]; bool check[302][302]; int dx[] = {0,1,0,-1}; int dy[] = {1,0,-1,0}; void dfs(int x,int y){ check[x][y] = true; for(int i=0; i<2; i++){ if(a[x+dx[i]][y+dy[i]] == 0 || check[x+dx[i]][y+dy[i]]) continue; dfs(x+dx[i],y+dy[i]); } } int main(){ scanf("%d %d",&M,&N); for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ scanf("%d",&a[i][j]); } } dfs(1,1); printf("%s\n",check[N][M]?"Yes":"No"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2464 KB | Output is correct |
2 | Correct | 0 ms | 2464 KB | Output is correct |
3 | Correct | 0 ms | 2464 KB | Output is correct |
4 | Correct | 0 ms | 2464 KB | Output is correct |
5 | Correct | 0 ms | 2464 KB | Output is correct |
6 | Correct | 0 ms | 2464 KB | Output is correct |
7 | Correct | 0 ms | 2464 KB | Output is correct |
8 | Correct | 0 ms | 2464 KB | Output is correct |
9 | Correct | 0 ms | 2464 KB | Output is correct |
10 | Correct | 0 ms | 2464 KB | Output is correct |
11 | Correct | 3 ms | 2464 KB | Output is correct |
12 | Correct | 0 ms | 2464 KB | Output is correct |
13 | Correct | 3 ms | 2464 KB | Output is correct |
14 | Correct | 3 ms | 2464 KB | Output is correct |
15 | Correct | 6 ms | 2464 KB | Output is correct |
16 | Correct | 6 ms | 2464 KB | Output is correct |
17 | Correct | 9 ms | 2464 KB | Output is correct |
18 | Correct | 9 ms | 2464 KB | Output is correct |
19 | Correct | 16 ms | 2464 KB | Output is correct |
20 | Correct | 6 ms | 2464 KB | Output is correct |