# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28090 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (#71) | The City and The Bitcoin (FXCUP2_city) | C++14 | 16 ms | 2464 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 <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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |