# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28133 | (#71) | The City and The Bitcoin (FXCUP2_city) | C++11 | 9 ms | 2024 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 <cstdio>
#include <queue>
#include <utility>
using namespace std;
bool vs[310][310];
queue<pair<int, int> > q;
int main(){
int N, M; scanf("%d%d", &M, &N);
for(int i = 1; i <= N; i++){
for(int j = 1; j <= M; j++){
int x; scanf("%d", &x); vs[i][j] = x;
}
}
bool ans = false;
q.push({1, 1}); vs[1][1] = false;
while(!q.empty()){
int x = q.front().first, y = q.front().second; q.pop();
if(x == N && y == M){ ans = true; break; }
if(x + 1 <= N && vs[x + 1][y]){
q.push({x + 1, y}); vs[x + 1][y] = false;
}
if(y + 1 <= M && vs[x][y + 1]){
q.push({x, y + 1}); vs[x][y + 1] = false;
}
}
puts(ans ? "Yes" : "No");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |