답안 #1031742

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031742 2024-07-23T06:20:20 Z 정민찬(#10962) Furniture (JOI20_furniture) C++17
5 / 100
3918 ms 1104 KB
#include <bits/stdc++.h>

using namespace std;

int n, m;
int C[1010][1010];
int dp[110][110];

bool Check() {
    memset(dp, 0, sizeof(dp));
    dp[1][1] = 1;
    for (int i=1; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            if (C[i][j]) continue;
            dp[i][j] |= dp[i-1][j];
            dp[i][j] |= dp[i][j-1];
        }
    }
    return dp[n][m];
}

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    cin >> n >> m;
    for (int i=1; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            cin >> C[i][j];
        }
    }
    int q;
    cin >> q;
    while (q --) {
        int x, y;
        cin >> x >> y;
        C[x][y] = 1;
        bool ret = Check();
        cout << ret << '\n';
        if (!ret) C[x][y] = 0;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 600 KB Output is correct
2 Correct 20 ms 860 KB Output is correct
3 Correct 43 ms 856 KB Output is correct
4 Correct 99 ms 928 KB Output is correct
5 Correct 111 ms 1104 KB Output is correct
6 Correct 149 ms 976 KB Output is correct
7 Correct 126 ms 964 KB Output is correct
8 Correct 214 ms 860 KB Output is correct
9 Correct 119 ms 988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 600 KB Output is correct
2 Correct 20 ms 860 KB Output is correct
3 Correct 43 ms 856 KB Output is correct
4 Correct 99 ms 928 KB Output is correct
5 Correct 111 ms 1104 KB Output is correct
6 Correct 149 ms 976 KB Output is correct
7 Correct 126 ms 964 KB Output is correct
8 Correct 214 ms 860 KB Output is correct
9 Correct 119 ms 988 KB Output is correct
10 Incorrect 3918 ms 1036 KB Output isn't correct
11 Halted 0 ms 0 KB -