답안 #599266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599266 2022-07-19T12:12:47 Z jmyszka2007 Furniture (JOI20_furniture) C++17
5 / 100
5000 ms 10144 KB
#include <bits/stdc++.h>
using namespace std;
int vis[1010][1010];
int meb[1010][1010];
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 852 KB Output is correct
2 Correct 14 ms 1112 KB Output is correct
3 Correct 48 ms 1020 KB Output is correct
4 Correct 78 ms 1052 KB Output is correct
5 Correct 85 ms 1108 KB Output is correct
6 Correct 151 ms 1108 KB Output is correct
7 Correct 58 ms 1116 KB Output is correct
8 Correct 72 ms 1108 KB Output is correct
9 Correct 158 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 852 KB Output is correct
2 Correct 14 ms 1112 KB Output is correct
3 Correct 48 ms 1020 KB Output is correct
4 Correct 78 ms 1052 KB Output is correct
5 Correct 85 ms 1108 KB Output is correct
6 Correct 151 ms 1108 KB Output is correct
7 Correct 58 ms 1116 KB Output is correct
8 Correct 72 ms 1108 KB Output is correct
9 Correct 158 ms 1108 KB Output is correct
10 Correct 2167 ms 928 KB Output is correct
11 Correct 84 ms 760 KB Output is correct
12 Execution timed out 5068 ms 10144 KB Time limit exceeded
13 Halted 0 ms 0 KB -