Submission #28196

# Submission time Handle Problem Language Result Execution time Memory
28196 2017-07-15T14:43:52 Z lyzqm123(#1224, lyzqm123) The City and The Bitcoin (FXCUP2_city) C++
0 / 1
0 ms 1824 KB
#include <cstdio>
int N, M;
int map[301][301];
int go[301][301];
int main() {
	scanf("%d%d", &M, &N);
	for (int n = 0;n < N;n++)
		for (int m = 0;m < M;m++)
			scanf("%d", &map[n][m]);
	go[0][0] = 1;
	for (int n = 0;n < N;n++) {
		for (int m = 0;m < M;m++) {
			if (go[n][m]) {
				if (n + 1 < N && map[n+1][m])
					go[n + 1][m] = 1;
				if (m + 1 < M && map[n][m+1])
					go[n][m + 1] = 1;
			}
		}
	}
	for (int n = 0;n < N;n++) {
		for (int m = 0;m < M;m++)
			printf("%d ", go[n][m]);
		printf("\n");
	}
	if (go[N - 1][M - 1])
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Compilation message

city.cpp: In function 'int main()':
city.cpp:6:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &M, &N);
                       ^
city.cpp:9:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &map[n][m]);
                           ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1824 KB Output isn't correct
2 Halted 0 ms 0 KB -