Submission #28101

# Submission time Handle Problem Language Result Execution time Memory
28101 2017-07-15T10:38:38 Z 외않된데?(#1196, solarmagic) The City and The Bitcoin (FXCUP2_city) C++
0 / 1
253 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\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

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 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 253 ms 65536 KB Memory limit exceeded
5 Halted 0 ms 0 KB -