답안 #399968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
399968 2021-05-07T02:01:06 Z syl123456 Bomb (IZhO17_bomb) C++17
28 / 100
241 ms 113092 KB
#include <bits/stdc++.h>
#define all(i) (i).begin(), (i).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl
using namespace std;
template<typename T1, typename T2>
ostream& operator << (ostream &i, pair<T1, T2> j) {
    return i << j.first << ' ' << j.second;
}
template<typename T>
ostream& operator << (ostream &i, vector<T> j) {
    i << '{' << j.size() << ':';
    for (T ii : j) i << ' ' << ii;
    return i << '}';
}
typedef long long ll;
typedef pair<int, int> pi;
int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> v(n + 2, string(m + 2, '0'));
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) cin >> v[i][j];
    vector<vector<int>> h(n + 2, vector<int>(m + 2, 0)), w(n + 2, vector<int>(m + 2, 0));
    int _h = n, _w = m;
    for (int i = n; i; --i) for (int j = m; j; --j) if (v[i][j] == '1') {
        h[i][j] = h[i + 1][j] + 1, w[i][j] = w[i][j + 1] + 1;
        if (v[i - 1][j] == '0') _h = min(_h, h[i][j]);
        if (v[i][j - 1] == '0') _w = min(_w, w[i][j]);
    }
    vector<int> lim(_h + 1, _w);
    for (int i = 1; i <= n; ++i) {
        pi pre(0, 0);
        for (int j = 1; j <= m + 1; ++j) {
            if (v[i - 1][j] == '0' && v[i][j - 1] == '0') {
                pre = pi(j, h[i][j]);
                continue;
            }
            if (h[i][j] >= pre.second) continue;
            lim[h[i][j] + 1] = min(lim[h[i][j] + 1], j - pre.first);
            pre.second = h[i][j];
        }
    }
    int ans = 0;
    for (int i = 1; i <= _h; ++i) lim[i] = min(lim[i], lim[i - 1]), ans = max(ans, i * lim[i]);
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Incorrect 1 ms 208 KB Output isn't correct
10 Correct 1 ms 204 KB Output is correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Incorrect 1 ms 204 KB Output isn't correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Incorrect 1 ms 312 KB Output isn't correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Incorrect 1 ms 332 KB Output isn't correct
20 Incorrect 1 ms 332 KB Output isn't correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Incorrect 2 ms 320 KB Output isn't correct
24 Incorrect 1 ms 332 KB Output isn't correct
25 Incorrect 1 ms 332 KB Output isn't correct
26 Correct 2 ms 316 KB Output is correct
27 Runtime error 4 ms 976 KB Execution killed with signal 6
28 Incorrect 4 ms 1356 KB Output isn't correct
29 Runtime error 6 ms 2764 KB Execution killed with signal 6
30 Incorrect 5 ms 1996 KB Output isn't correct
31 Incorrect 4 ms 1740 KB Output isn't correct
32 Incorrect 5 ms 1740 KB Output isn't correct
33 Incorrect 6 ms 2252 KB Output isn't correct
34 Runtime error 4 ms 1996 KB Execution killed with signal 6
35 Incorrect 5 ms 2252 KB Output isn't correct
36 Correct 6 ms 2140 KB Output is correct
37 Incorrect 1 ms 204 KB Output isn't correct
38 Correct 152 ms 55880 KB Output is correct
39 Incorrect 1 ms 204 KB Output isn't correct
40 Incorrect 21 ms 7452 KB Output isn't correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Runtime error 196 ms 112868 KB Execution killed with signal 11
44 Correct 7 ms 2256 KB Output is correct
45 Runtime error 202 ms 112968 KB Execution killed with signal 6
46 Correct 147 ms 55880 KB Output is correct
47 Incorrect 143 ms 55876 KB Output isn't correct
48 Runtime error 241 ms 112948 KB Execution killed with signal 6
49 Correct 152 ms 55888 KB Output is correct
50 Runtime error 207 ms 112896 KB Execution killed with signal 6
51 Runtime error 201 ms 112968 KB Execution killed with signal 6
52 Runtime error 194 ms 112900 KB Execution killed with signal 11
53 Runtime error 199 ms 112964 KB Execution killed with signal 6
54 Runtime error 196 ms 113000 KB Execution killed with signal 6
55 Runtime error 197 ms 112892 KB Execution killed with signal 6
56 Correct 158 ms 55856 KB Output is correct
57 Runtime error 196 ms 112960 KB Execution killed with signal 6
58 Runtime error 194 ms 112904 KB Execution killed with signal 6
59 Runtime error 192 ms 112964 KB Execution killed with signal 6
60 Correct 142 ms 55808 KB Output is correct
61 Correct 151 ms 55876 KB Output is correct
62 Correct 152 ms 55900 KB Output is correct
63 Runtime error 211 ms 112992 KB Execution killed with signal 6
64 Correct 141 ms 55856 KB Output is correct
65 Runtime error 200 ms 113088 KB Execution killed with signal 6
66 Incorrect 142 ms 55852 KB Output isn't correct
67 Runtime error 205 ms 113092 KB Execution killed with signal 6
68 Runtime error 206 ms 112932 KB Execution killed with signal 6
69 Runtime error 194 ms 112964 KB Execution killed with signal 6
70 Incorrect 85 ms 35956 KB Output isn't correct
71 Incorrect 132 ms 55860 KB Output isn't correct
72 Incorrect 134 ms 55800 KB Output isn't correct
73 Incorrect 137 ms 55852 KB Output isn't correct
74 Incorrect 136 ms 55920 KB Output isn't correct
75 Incorrect 136 ms 55840 KB Output isn't correct
76 Incorrect 137 ms 55876 KB Output isn't correct
77 Incorrect 140 ms 55840 KB Output isn't correct
78 Incorrect 140 ms 55884 KB Output isn't correct
79 Incorrect 131 ms 55876 KB Output isn't correct
80 Incorrect 130 ms 55876 KB Output isn't correct
81 Incorrect 133 ms 55916 KB Output isn't correct
82 Incorrect 141 ms 55984 KB Output isn't correct
83 Incorrect 137 ms 55900 KB Output isn't correct
84 Incorrect 144 ms 55892 KB Output isn't correct
85 Incorrect 138 ms 55792 KB Output isn't correct
86 Incorrect 149 ms 55996 KB Output isn't correct
87 Incorrect 135 ms 55784 KB Output isn't correct
88 Incorrect 135 ms 55876 KB Output isn't correct
89 Incorrect 141 ms 55892 KB Output isn't correct
90 Incorrect 90 ms 36128 KB Output isn't correct
91 Incorrect 140 ms 55904 KB Output isn't correct
92 Incorrect 139 ms 55884 KB Output isn't correct
93 Incorrect 148 ms 55884 KB Output isn't correct
94 Incorrect 142 ms 55992 KB Output isn't correct
95 Incorrect 136 ms 55876 KB Output isn't correct
96 Incorrect 140 ms 55896 KB Output isn't correct
97 Incorrect 151 ms 56004 KB Output isn't correct
98 Incorrect 136 ms 55856 KB Output isn't correct
99 Incorrect 140 ms 55876 KB Output isn't correct
100 Incorrect 148 ms 55816 KB Output isn't correct