# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28089 | 2017-07-15T10:25:37 Z | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(#1199, suhgyuho_william) | The City and The Bitcoin (FXCUP2_city) | C++14 | 0 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<4; 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 | Incorrect | 0 ms | 2464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |