답안 #599264

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599264 2022-07-19T12:12:02 Z jmyszka2007 Furniture (JOI20_furniture) C++17
5 / 100
912 ms 756 KB
#include <bits/stdc++.h>
using namespace std;
int vis[110][110];
int meb[110][110];
int n, m;
void dfs(int x, int y) {
	if(x > n || y > m || vis[x][y]) {
		return;
	}
	vis[x][y] = 1;
	dfs(x + 1, y);
	dfs(x, y + 1);
}
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			scanf("%d", &meb[i][j]);
		}
	}
	int t;
	scanf("%d", &t);
	while(t--) {
		for(int i = 1; i <= n; i++) {
			for(int j = 1; j <= m; j++) {
				vis[i][j] = meb[i][j];
			}
		}
		int a, b;
		scanf("%d%d", &a, &b);
		vis[a][b] = 1;
		dfs(1, 1);
		if(vis[n][m]) {
			printf("%d\n", 1);
			meb[a][b] = 1;
		}
		else {
			printf("%d\n", 0);
		}
	}
}
 

Compilation message

furniture.cpp: In function 'int main()':
furniture.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
furniture.cpp:18:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |    scanf("%d", &meb[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~~~
furniture.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  scanf("%d", &t);
      |  ~~~~~^~~~~~~~~~
furniture.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |   scanf("%d%d", &a, &b);
      |   ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 340 KB Output is correct
2 Correct 14 ms 340 KB Output is correct
3 Correct 48 ms 408 KB Output is correct
4 Correct 84 ms 444 KB Output is correct
5 Correct 87 ms 444 KB Output is correct
6 Correct 142 ms 468 KB Output is correct
7 Correct 57 ms 468 KB Output is correct
8 Correct 71 ms 448 KB Output is correct
9 Correct 157 ms 472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 340 KB Output is correct
2 Correct 14 ms 340 KB Output is correct
3 Correct 48 ms 408 KB Output is correct
4 Correct 84 ms 444 KB Output is correct
5 Correct 87 ms 444 KB Output is correct
6 Correct 142 ms 468 KB Output is correct
7 Correct 57 ms 468 KB Output is correct
8 Correct 71 ms 448 KB Output is correct
9 Correct 157 ms 472 KB Output is correct
10 Incorrect 912 ms 756 KB Output isn't correct
11 Halted 0 ms 0 KB -