# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28101 | 외않된데? (#71) | The City and The Bitcoin (FXCUP2_city) | C++98 | 253 ms | 65536 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>
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\n");
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\n");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |