# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
399972 |
2021-05-07T02:16:11 Z |
syl123456 |
Bomb (IZhO17_bomb) |
C++17 |
|
156 ms |
55816 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, h[i][j]);
continue;
}
if (h[i][j] >= pre.second) continue;
if (h[i][j] + 1 >= lim.size()) return 0;
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;
}
Compilation message
bomb.cpp: In function 'int main()':
bomb.cpp:39:29: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | if (h[i][j] + 1 >= lim.size()) return 0;
# |
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 |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
204 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 |
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 |
Incorrect |
1 ms |
204 KB |
Output isn't 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 |
Incorrect |
1 ms |
332 KB |
Output isn't 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 |
336 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 |
Incorrect |
3 ms |
972 KB |
Output isn't correct |
28 |
Incorrect |
3 ms |
1228 KB |
Output isn't correct |
29 |
Incorrect |
4 ms |
1356 KB |
Output isn't correct |
30 |
Incorrect |
5 ms |
1996 KB |
Output isn't correct |
31 |
Incorrect |
5 ms |
1612 KB |
Output isn't correct |
32 |
Incorrect |
4 ms |
1740 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 |
Incorrect |
6 ms |
2124 KB |
Output isn't correct |
37 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
38 |
Correct |
149 ms |
55692 KB |
Output is correct |
39 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
40 |
Incorrect |
19 ms |
7248 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
42 |
Correct |
1 ms |
332 KB |
Output is correct |
43 |
Incorrect |
136 ms |
55684 KB |
Output isn't correct |
44 |
Correct |
6 ms |
2124 KB |
Output is correct |
45 |
Incorrect |
144 ms |
55620 KB |
Output isn't correct |
46 |
Correct |
143 ms |
55620 KB |
Output is correct |
47 |
Incorrect |
142 ms |
55680 KB |
Output isn't correct |
48 |
Incorrect |
135 ms |
55692 KB |
Output isn't correct |
49 |
Incorrect |
148 ms |
55680 KB |
Output isn't correct |
50 |
Incorrect |
135 ms |
55676 KB |
Output isn't correct |
51 |
Incorrect |
132 ms |
55620 KB |
Output isn't correct |
52 |
Incorrect |
135 ms |
55616 KB |
Output isn't correct |
53 |
Incorrect |
133 ms |
55684 KB |
Output isn't correct |
54 |
Incorrect |
130 ms |
55620 KB |
Output isn't correct |
55 |
Incorrect |
139 ms |
55696 KB |
Output isn't correct |
56 |
Correct |
152 ms |
55680 KB |
Output is correct |
57 |
Incorrect |
131 ms |
55696 KB |
Output isn't correct |
58 |
Incorrect |
128 ms |
55688 KB |
Output isn't correct |
59 |
Incorrect |
129 ms |
55604 KB |
Output isn't correct |
60 |
Correct |
152 ms |
55692 KB |
Output is correct |
61 |
Incorrect |
144 ms |
55696 KB |
Output isn't correct |
62 |
Correct |
149 ms |
55676 KB |
Output is correct |
63 |
Correct |
149 ms |
55696 KB |
Output is correct |
64 |
Correct |
136 ms |
55692 KB |
Output is correct |
65 |
Incorrect |
131 ms |
55620 KB |
Output isn't correct |
66 |
Incorrect |
138 ms |
55696 KB |
Output isn't correct |
67 |
Incorrect |
134 ms |
55700 KB |
Output isn't correct |
68 |
Incorrect |
140 ms |
55620 KB |
Output isn't correct |
69 |
Incorrect |
131 ms |
55680 KB |
Output isn't correct |
70 |
Incorrect |
83 ms |
35928 KB |
Output isn't correct |
71 |
Incorrect |
134 ms |
55688 KB |
Output isn't correct |
72 |
Incorrect |
133 ms |
55696 KB |
Output isn't correct |
73 |
Incorrect |
135 ms |
55680 KB |
Output isn't correct |
74 |
Incorrect |
133 ms |
55684 KB |
Output isn't correct |
75 |
Incorrect |
135 ms |
55680 KB |
Output isn't correct |
76 |
Incorrect |
156 ms |
55688 KB |
Output isn't correct |
77 |
Incorrect |
135 ms |
55620 KB |
Output isn't correct |
78 |
Incorrect |
134 ms |
55592 KB |
Output isn't correct |
79 |
Incorrect |
132 ms |
55676 KB |
Output isn't correct |
80 |
Incorrect |
127 ms |
55620 KB |
Output isn't correct |
81 |
Incorrect |
139 ms |
55692 KB |
Output isn't correct |
82 |
Incorrect |
135 ms |
55688 KB |
Output isn't correct |
83 |
Incorrect |
136 ms |
55680 KB |
Output isn't correct |
84 |
Incorrect |
127 ms |
55684 KB |
Output isn't correct |
85 |
Incorrect |
137 ms |
55620 KB |
Output isn't correct |
86 |
Incorrect |
147 ms |
55676 KB |
Output isn't correct |
87 |
Incorrect |
135 ms |
55816 KB |
Output isn't correct |
88 |
Incorrect |
153 ms |
55692 KB |
Output isn't correct |
89 |
Incorrect |
138 ms |
55620 KB |
Output isn't correct |
90 |
Incorrect |
87 ms |
35808 KB |
Output isn't correct |
91 |
Incorrect |
138 ms |
55680 KB |
Output isn't correct |
92 |
Incorrect |
139 ms |
55620 KB |
Output isn't correct |
93 |
Incorrect |
148 ms |
55676 KB |
Output isn't correct |
94 |
Incorrect |
137 ms |
55676 KB |
Output isn't correct |
95 |
Incorrect |
142 ms |
55620 KB |
Output isn't correct |
96 |
Incorrect |
144 ms |
55680 KB |
Output isn't correct |
97 |
Incorrect |
147 ms |
55620 KB |
Output isn't correct |
98 |
Incorrect |
135 ms |
55684 KB |
Output isn't correct |
99 |
Incorrect |
143 ms |
55696 KB |
Output isn't correct |
100 |
Incorrect |
147 ms |
55676 KB |
Output isn't correct |