Submission #28094

#TimeUsernameProblemLanguageResultExecution timeMemory
28094외않된데? (#71)The City and The Bitcoin (FXCUP2_city)C++14
0 / 1
296 ms65536 KiB
#include <cstdio> #include <queue> using namespace std; typedef pair<int, int> p; // city[y][x]; N==x�� ����, M==y�� ���� int city[333][333]; int main() { int N, M; scanf("%d %d", &N, &M); for (int i = 1; i <= M; ++i) { for (int j = 1; j <= N; ++j) { scanf("%d", &city[i][j]); } } queue<p> q; q.push(p(1, 1)); while (!q.empty()) { p n = q.front(); q.pop(); if (n.first == M && n.second == N) { printf("Yes"); return 0; } if (n.first + 1 <= M && city[n.first + 1][n.second] == 1) q.push(p(n.first + 1, n.second)); if (n.second + 1 <= N && city[n.first][n.second + 1] == 1) q.push(p(n.first, n.second + 1)); } printf("No"); return 0; }

Compilation message (stderr)

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