답안 #833280

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833280 2023-08-22T04:02:41 Z vjudge1 Bomb (IZhO17_bomb) C++17
24 / 100
311 ms 49372 KB
#include <bits/stdc++.h>
using namespace std;

int n, m;
const int maxn = 2504;
int chainw[maxn][maxn];
int chainh[maxn][maxn];

int getParentW(int i, int j) {
    if (chainw[i][j+1] != 0) return getParentW(i, j+1);
    return j;
}

int getParentH(int i, int j) {
    if (chainh[i+1][j] != 0) return getParentH(i+1, j);
    return i;
}

int main() {
    cin >> n >> m;

    int all0 = true;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            char x;
            cin >> x;
            if (x == '1') {
                all0 = false;
                chainw[i][j] = chainw[i][j-1]+1;
                chainh[i][j] = chainh[i-1][j]+1;
            }
        }
    }

    if (all0) {
        cout << 0 << endl;
        return 0;
    }

    int maxpossiblew = maxn;
    int maxpossibleh = maxn;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            j = getParentW(i, j);
            if (chainw[i][j] == 0) continue;
            maxpossiblew = min(maxpossiblew, chainw[i][j]);
        }
        // if (maxw[i] == 0) continue;
        // maxpossiblew = min(maxpossiblew, chainw[i][maxw[i]]);
    }

    for (int j = 1; j <= m; j++) {
        for (int i = 1; i <= n; i++) {
            i = getParentH(i, j);
            if (chainh[i][j] == 0) continue;
            maxpossibleh = min(maxpossibleh, chainh[i][j]);
        }
        // if (maxw[i] == 0) continue;
        // maxpossiblew = min(maxpossiblew, chainw[i][maxw[i]]);
    }

    cout << maxpossibleh * maxpossiblew << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 9 ms 20296 KB Output is correct
4 Correct 10 ms 20308 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 0 ms 340 KB Output isn't correct
9 Incorrect 0 ms 340 KB Output isn't correct
10 Incorrect 0 ms 424 KB Output isn't correct
11 Incorrect 0 ms 340 KB Output isn't correct
12 Incorrect 0 ms 340 KB Output isn't correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Incorrect 0 ms 340 KB Output isn't correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 1 ms 852 KB Output is correct
18 Incorrect 1 ms 596 KB Output isn't correct
19 Incorrect 1 ms 724 KB Output isn't correct
20 Incorrect 1 ms 724 KB Output isn't correct
21 Incorrect 1 ms 340 KB Output isn't correct
22 Incorrect 1 ms 596 KB Output isn't correct
23 Incorrect 1 ms 724 KB Output isn't correct
24 Incorrect 1 ms 724 KB Output isn't correct
25 Incorrect 1 ms 980 KB Output isn't correct
26 Correct 1 ms 1108 KB Output is correct
27 Correct 4 ms 3284 KB Output is correct
28 Incorrect 5 ms 712 KB Output isn't correct
29 Incorrect 6 ms 4160 KB Output isn't correct
30 Incorrect 8 ms 3028 KB Output isn't correct
31 Incorrect 6 ms 2220 KB Output isn't correct
32 Incorrect 7 ms 3028 KB Output isn't correct
33 Incorrect 9 ms 4120 KB Output isn't correct
34 Incorrect 4 ms 724 KB Output isn't correct
35 Incorrect 8 ms 852 KB Output isn't correct
36 Correct 9 ms 5460 KB Output is correct
37 Incorrect 1 ms 468 KB Output isn't correct
38 Correct 255 ms 49208 KB Output is correct
39 Incorrect 0 ms 468 KB Output isn't correct
40 Incorrect 31 ms 13336 KB Output isn't correct
41 Incorrect 0 ms 468 KB Output isn't correct
42 Incorrect 1 ms 1108 KB Output isn't correct
43 Correct 252 ms 45376 KB Output is correct
44 Incorrect 9 ms 4820 KB Output isn't correct
45 Incorrect 255 ms 46684 KB Output isn't correct
46 Correct 258 ms 49300 KB Output is correct
47 Incorrect 257 ms 46780 KB Output isn't correct
48 Incorrect 260 ms 49372 KB Output isn't correct
49 Correct 257 ms 49200 KB Output is correct
50 Incorrect 264 ms 49236 KB Output isn't correct
51 Incorrect 262 ms 49160 KB Output isn't correct
52 Incorrect 254 ms 49196 KB Output isn't correct
53 Incorrect 253 ms 48556 KB Output isn't correct
54 Incorrect 266 ms 35996 KB Output isn't correct
55 Incorrect 252 ms 34196 KB Output isn't correct
56 Correct 253 ms 49300 KB Output is correct
57 Incorrect 252 ms 29400 KB Output isn't correct
58 Incorrect 259 ms 34296 KB Output isn't correct
59 Incorrect 257 ms 31280 KB Output isn't correct
60 Correct 252 ms 41020 KB Output is correct
61 Correct 247 ms 49268 KB Output is correct
62 Correct 258 ms 49288 KB Output is correct
63 Correct 260 ms 49192 KB Output is correct
64 Correct 255 ms 32092 KB Output is correct
65 Incorrect 261 ms 48108 KB Output isn't correct
66 Incorrect 260 ms 45140 KB Output isn't correct
67 Incorrect 260 ms 49292 KB Output isn't correct
68 Incorrect 253 ms 49228 KB Output isn't correct
69 Incorrect 256 ms 28912 KB Output isn't correct
70 Incorrect 155 ms 10292 KB Output isn't correct
71 Incorrect 247 ms 21856 KB Output isn't correct
72 Incorrect 250 ms 27428 KB Output isn't correct
73 Incorrect 251 ms 27884 KB Output isn't correct
74 Incorrect 249 ms 29388 KB Output isn't correct
75 Incorrect 249 ms 30996 KB Output isn't correct
76 Incorrect 258 ms 32332 KB Output isn't correct
77 Incorrect 252 ms 32752 KB Output isn't correct
78 Incorrect 311 ms 32984 KB Output isn't correct
79 Incorrect 243 ms 5624 KB Output isn't correct
80 Incorrect 239 ms 6900 KB Output isn't correct
81 Incorrect 239 ms 7248 KB Output isn't correct
82 Incorrect 257 ms 35600 KB Output isn't correct
83 Incorrect 256 ms 35696 KB Output isn't correct
84 Incorrect 239 ms 980 KB Output isn't correct
85 Incorrect 253 ms 34604 KB Output isn't correct
86 Incorrect 253 ms 48076 KB Output isn't correct
87 Incorrect 288 ms 33580 KB Output isn't correct
88 Incorrect 253 ms 34420 KB Output isn't correct
89 Incorrect 252 ms 43344 KB Output isn't correct
90 Incorrect 159 ms 24444 KB Output isn't correct
91 Incorrect 257 ms 38368 KB Output isn't correct
92 Incorrect 252 ms 39988 KB Output isn't correct
93 Incorrect 249 ms 47260 KB Output isn't correct
94 Incorrect 259 ms 41872 KB Output isn't correct
95 Incorrect 250 ms 35788 KB Output isn't correct
96 Incorrect 281 ms 35448 KB Output isn't correct
97 Incorrect 248 ms 47920 KB Output isn't correct
98 Incorrect 258 ms 35264 KB Output isn't correct
99 Incorrect 259 ms 41456 KB Output isn't correct
100 Incorrect 249 ms 46796 KB Output isn't correct