Submission #28133

#TimeUsernameProblemLanguageResultExecution timeMemory
28133 (#71)The City and The Bitcoin (FXCUP2_city)C++11
1 / 1
9 ms2024 KiB
#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)

city.cpp: In function 'int main()':
city.cpp:10:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int N, M; scanf("%d%d", &M, &N);
                                  ^
city.cpp:13:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       int x; scanf("%d", &x); vs[i][j] = x;
                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...