답안 #27191

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27191 2017-07-10T07:52:38 Z 검수컵(#1129) 도시와 비트코인 (FXCUP2_city) C++
1 / 1
9 ms 1980 KB
#include<stdio.h>

int N, M, ba[333][333], chk[333][333];

void dfs(int x, int y){
	if(x >= M || y >= N) return;
	if(!ba[x][y] || chk[x][y]) return;
	chk[x][y] = 1;
	dfs(x+1, y); dfs(x, y+1);
}

int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++) for(int j=0; j<N; j++) scanf("%d", &ba[i][j]);
	dfs(0,0);
	puts(chk[M-1][N-1] ? "Yes" : "No");
	return 0;
}

Compilation message

city.cpp: In function 'int main()':
city.cpp:13:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
                       ^
city.cpp:14:70: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0; i<M; i++) for(int j=0; j<N; j++) scanf("%d", &ba[i][j]);
                                                                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1980 KB Output is correct
2 Correct 0 ms 1980 KB Output is correct
3 Correct 0 ms 1980 KB Output is correct
4 Correct 0 ms 1980 KB Output is correct
5 Correct 0 ms 1980 KB Output is correct
6 Correct 0 ms 1980 KB Output is correct
7 Correct 0 ms 1980 KB Output is correct
8 Correct 0 ms 1980 KB Output is correct
9 Correct 0 ms 1980 KB Output is correct
10 Correct 0 ms 1980 KB Output is correct
11 Correct 0 ms 1980 KB Output is correct
12 Correct 3 ms 1980 KB Output is correct
13 Correct 3 ms 1980 KB Output is correct
14 Correct 3 ms 1980 KB Output is correct
15 Correct 6 ms 1980 KB Output is correct
16 Correct 6 ms 1980 KB Output is correct
17 Correct 6 ms 1980 KB Output is correct
18 Correct 9 ms 1980 KB Output is correct
19 Correct 6 ms 1980 KB Output is correct
20 Correct 9 ms 1980 KB Output is correct