답안 #28078

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28078 2017-07-15T10:09:27 Z 외않된데?(#1196, solarmagic) 도시와 비트코인 (FXCUP2_city) C++
0 / 1
149 ms 65536 KB
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> p;
bool city[333][333];
int main()
{
	//n�� ����, m�� ����
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i <m; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			scanf("%d", &city[i][j]);
		}
	}
	
	queue<p> q;
	q.push(p(0, 0));
	while (!q.empty())
	{
		p now = q.front();
		q.pop();

		if (now.first == m - 1 && now.second == n - 1)
		{
			printf("Yes");
			return 0;
		}
		if (now.first + 1 < m)
		{
			q.push(p(now.first + 1, now.second));
		}
		if (now.second + 1 < n)
		{
			q.push(p(now.first, now.second + 1));
		}
	}
	printf("No");
	return 0;
}

Compilation message

city.cpp: In function 'int main()':
city.cpp:16:27: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'bool*' [-Wformat=]
    scanf("%d", &city[i][j]);
                           ^
city.cpp:11: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:16:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &city[i][j]);
                            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2040 KB Output is correct
2 Memory limit exceeded 149 ms 65536 KB Memory limit exceeded
3 Halted 0 ms 0 KB -