# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
399975 |
2021-05-07T02:18:58 Z |
syl123456 |
Bomb (IZhO17_bomb) |
C++17 |
|
163 ms |
56148 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 + 2, _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, min(_h, 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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
588 KB |
Output is correct |
4 |
Correct |
1 ms |
588 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
296 KB |
Output is correct |
8 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
10 |
Correct |
1 ms |
208 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 |
204 KB |
Output isn't correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
332 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 |
1 ms |
332 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 |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
3 ms |
972 KB |
Output is correct |
28 |
Incorrect |
3 ms |
1356 KB |
Output isn't correct |
29 |
Incorrect |
4 ms |
1484 KB |
Output isn't correct |
30 |
Incorrect |
5 ms |
1996 KB |
Output isn't correct |
31 |
Incorrect |
4 ms |
1688 KB |
Output isn't correct |
32 |
Incorrect |
6 ms |
1700 KB |
Output isn't correct |
33 |
Incorrect |
6 ms |
2124 KB |
Output isn't correct |
34 |
Incorrect |
3 ms |
1100 KB |
Output isn't correct |
35 |
Incorrect |
5 ms |
2124 KB |
Output isn't correct |
36 |
Correct |
6 ms |
2124 KB |
Output is correct |
37 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
38 |
Correct |
151 ms |
55836 KB |
Output is correct |
39 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
40 |
Incorrect |
21 ms |
7280 KB |
Output isn't correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
332 KB |
Output is correct |
43 |
Correct |
145 ms |
55876 KB |
Output is correct |
44 |
Correct |
7 ms |
2124 KB |
Output is correct |
45 |
Incorrect |
151 ms |
56148 KB |
Output isn't correct |
46 |
Correct |
147 ms |
55876 KB |
Output is correct |
47 |
Incorrect |
147 ms |
55896 KB |
Output isn't correct |
48 |
Correct |
141 ms |
55880 KB |
Output is correct |
49 |
Correct |
154 ms |
56000 KB |
Output is correct |
50 |
Incorrect |
145 ms |
55908 KB |
Output isn't correct |
51 |
Incorrect |
150 ms |
55936 KB |
Output isn't correct |
52 |
Correct |
142 ms |
55920 KB |
Output is correct |
53 |
Incorrect |
143 ms |
55864 KB |
Output isn't correct |
54 |
Correct |
137 ms |
55932 KB |
Output is correct |
55 |
Incorrect |
136 ms |
55892 KB |
Output isn't correct |
56 |
Correct |
151 ms |
55896 KB |
Output is correct |
57 |
Incorrect |
159 ms |
55872 KB |
Output isn't correct |
58 |
Correct |
136 ms |
55856 KB |
Output is correct |
59 |
Correct |
135 ms |
55876 KB |
Output is correct |
60 |
Correct |
145 ms |
56048 KB |
Output is correct |
61 |
Correct |
148 ms |
55876 KB |
Output is correct |
62 |
Correct |
149 ms |
55924 KB |
Output is correct |
63 |
Correct |
152 ms |
55864 KB |
Output is correct |
64 |
Correct |
140 ms |
55988 KB |
Output is correct |
65 |
Correct |
140 ms |
55892 KB |
Output is correct |
66 |
Incorrect |
163 ms |
55932 KB |
Output isn't correct |
67 |
Correct |
145 ms |
55880 KB |
Output is correct |
68 |
Incorrect |
147 ms |
55876 KB |
Output isn't correct |
69 |
Correct |
148 ms |
55876 KB |
Output is correct |
70 |
Incorrect |
86 ms |
36036 KB |
Output isn't correct |
71 |
Incorrect |
135 ms |
55820 KB |
Output isn't correct |
72 |
Incorrect |
137 ms |
55928 KB |
Output isn't correct |
73 |
Incorrect |
135 ms |
55876 KB |
Output isn't correct |
74 |
Incorrect |
135 ms |
55872 KB |
Output isn't correct |
75 |
Incorrect |
139 ms |
55904 KB |
Output isn't correct |
76 |
Incorrect |
147 ms |
55924 KB |
Output isn't correct |
77 |
Incorrect |
138 ms |
55924 KB |
Output isn't correct |
78 |
Incorrect |
135 ms |
55872 KB |
Output isn't correct |
79 |
Incorrect |
132 ms |
55852 KB |
Output isn't correct |
80 |
Incorrect |
136 ms |
55932 KB |
Output isn't correct |
81 |
Incorrect |
130 ms |
55876 KB |
Output isn't correct |
82 |
Incorrect |
138 ms |
55876 KB |
Output isn't correct |
83 |
Incorrect |
137 ms |
55876 KB |
Output isn't correct |
84 |
Incorrect |
130 ms |
55920 KB |
Output isn't correct |
85 |
Incorrect |
137 ms |
55880 KB |
Output isn't correct |
86 |
Incorrect |
147 ms |
55920 KB |
Output isn't correct |
87 |
Incorrect |
138 ms |
55876 KB |
Output isn't correct |
88 |
Incorrect |
137 ms |
55916 KB |
Output isn't correct |
89 |
Incorrect |
148 ms |
55940 KB |
Output isn't correct |
90 |
Incorrect |
87 ms |
36020 KB |
Output isn't correct |
91 |
Incorrect |
139 ms |
56020 KB |
Output isn't correct |
92 |
Incorrect |
142 ms |
55964 KB |
Output isn't correct |
93 |
Incorrect |
147 ms |
55876 KB |
Output isn't correct |
94 |
Incorrect |
142 ms |
55856 KB |
Output isn't correct |
95 |
Incorrect |
138 ms |
55832 KB |
Output isn't correct |
96 |
Incorrect |
139 ms |
55980 KB |
Output isn't correct |
97 |
Incorrect |
147 ms |
55844 KB |
Output isn't correct |
98 |
Incorrect |
139 ms |
55912 KB |
Output isn't correct |
99 |
Incorrect |
139 ms |
55916 KB |
Output isn't correct |
100 |
Incorrect |
152 ms |
55928 KB |
Output isn't correct |