# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28094 | 2017-07-15T10:31:42 Z | 외않된데?(#1196, solarmagic) | The City and The Bitcoin (FXCUP2_city) | C++14 | 296 ms | 65536 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2364 KB | Output is correct |
2 | Correct | 0 ms | 2364 KB | Output is correct |
3 | Correct | 0 ms | 2364 KB | Output is correct |
4 | Memory limit exceeded | 296 ms | 65536 KB | Memory limit exceeded |
5 | Halted | 0 ms | 0 KB | - |