# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
404483 |
2021-05-14T13:34:12 Z |
rama_pang |
Bomb (IZhO17_bomb) |
C++17 |
|
349 ms |
129308 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N, M;
cin >> N >> M;
vector<vector<int>> A(N, vector<int>(M));
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
char c;
cin >> c;
A[i][j] = c - '0';
}
}
const auto Solve = [&](const vector<vector<int>> &A) {
vector<vector<int>> H, V;
H.assign(N, vector<int>(M, 0));
V.assign(N, vector<int>(M, 0));
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) if (A[i][j] == 1) {
int jj = j;
while (jj + 1 < M && A[i][jj + 1] == 1) jj += 1;
for (int k = j; k <= jj; k++) {
H[i][k] = jj - j + 1;
}
j = jj;
}
}
for (int j = 0; j < M; j++) {
for (int i = 0; i < N; i++) if (A[i][j] == 1) {
int ii = i;
while (ii + 1 < N && A[ii + 1][j] == 1) ii += 1;
for (int k = i; k <= ii; k++) {
V[k][j] = ii - i + 1;
}
i = ii;
}
}
return pair(H, V);
};
auto [H, V] = Solve(A);
int ansN = N;
int ansM = M;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) if (A[i][j] != 0) {
ansN = min(ansN, V[i][j]);
ansM = min(ansM, H[i][j]);
}
}
cout << ansN * ansM << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
972 KB |
Output is correct |
4 |
Correct |
2 ms |
956 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 |
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 |
Incorrect |
1 ms |
204 KB |
Output isn't 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 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
26 |
Correct |
1 ms |
460 KB |
Output is correct |
27 |
Correct |
4 ms |
1988 KB |
Output is correct |
28 |
Incorrect |
4 ms |
2636 KB |
Output isn't correct |
29 |
Incorrect |
5 ms |
2884 KB |
Output isn't correct |
30 |
Incorrect |
7 ms |
4172 KB |
Output isn't correct |
31 |
Incorrect |
6 ms |
3364 KB |
Output isn't correct |
32 |
Incorrect |
6 ms |
3532 KB |
Output isn't correct |
33 |
Incorrect |
8 ms |
4428 KB |
Output isn't correct |
34 |
Incorrect |
4 ms |
2008 KB |
Output isn't correct |
35 |
Incorrect |
7 ms |
4428 KB |
Output isn't correct |
36 |
Correct |
8 ms |
4428 KB |
Output is correct |
37 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
38 |
Correct |
322 ms |
129212 KB |
Output is correct |
39 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
40 |
Incorrect |
29 ms |
16272 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
43 |
Correct |
294 ms |
129132 KB |
Output is correct |
44 |
Incorrect |
7 ms |
4428 KB |
Output isn't correct |
45 |
Incorrect |
289 ms |
129200 KB |
Output isn't correct |
46 |
Correct |
277 ms |
129132 KB |
Output is correct |
47 |
Incorrect |
290 ms |
129236 KB |
Output isn't correct |
48 |
Incorrect |
283 ms |
129168 KB |
Output isn't correct |
49 |
Correct |
319 ms |
129132 KB |
Output is correct |
50 |
Incorrect |
289 ms |
129092 KB |
Output isn't correct |
51 |
Incorrect |
282 ms |
129168 KB |
Output isn't correct |
52 |
Incorrect |
298 ms |
129176 KB |
Output isn't correct |
53 |
Incorrect |
281 ms |
129128 KB |
Output isn't correct |
54 |
Incorrect |
262 ms |
129128 KB |
Output isn't correct |
55 |
Incorrect |
275 ms |
129220 KB |
Output isn't correct |
56 |
Correct |
330 ms |
129092 KB |
Output is correct |
57 |
Incorrect |
278 ms |
129160 KB |
Output isn't correct |
58 |
Incorrect |
277 ms |
129092 KB |
Output isn't correct |
59 |
Incorrect |
275 ms |
129168 KB |
Output isn't correct |
60 |
Correct |
296 ms |
129092 KB |
Output is correct |
61 |
Correct |
336 ms |
129184 KB |
Output is correct |
62 |
Correct |
331 ms |
129168 KB |
Output is correct |
63 |
Correct |
349 ms |
129128 KB |
Output is correct |
64 |
Correct |
282 ms |
129176 KB |
Output is correct |
65 |
Incorrect |
299 ms |
129220 KB |
Output isn't correct |
66 |
Incorrect |
298 ms |
129220 KB |
Output isn't correct |
67 |
Incorrect |
302 ms |
129172 KB |
Output isn't correct |
68 |
Incorrect |
308 ms |
129252 KB |
Output isn't correct |
69 |
Incorrect |
282 ms |
129160 KB |
Output isn't correct |
70 |
Incorrect |
169 ms |
82760 KB |
Output isn't correct |
71 |
Incorrect |
270 ms |
129180 KB |
Output isn't correct |
72 |
Incorrect |
281 ms |
129308 KB |
Output isn't correct |
73 |
Incorrect |
279 ms |
129168 KB |
Output isn't correct |
74 |
Incorrect |
275 ms |
129160 KB |
Output isn't correct |
75 |
Incorrect |
277 ms |
129180 KB |
Output isn't correct |
76 |
Incorrect |
284 ms |
129180 KB |
Output isn't correct |
77 |
Incorrect |
283 ms |
129172 KB |
Output isn't correct |
78 |
Incorrect |
292 ms |
129208 KB |
Output isn't correct |
79 |
Incorrect |
253 ms |
129256 KB |
Output isn't correct |
80 |
Incorrect |
257 ms |
129220 KB |
Output isn't correct |
81 |
Incorrect |
262 ms |
129168 KB |
Output isn't correct |
82 |
Incorrect |
282 ms |
129092 KB |
Output isn't correct |
83 |
Incorrect |
305 ms |
129128 KB |
Output isn't correct |
84 |
Incorrect |
261 ms |
129200 KB |
Output isn't correct |
85 |
Incorrect |
295 ms |
129132 KB |
Output isn't correct |
86 |
Incorrect |
326 ms |
129164 KB |
Output isn't correct |
87 |
Incorrect |
277 ms |
129296 KB |
Output isn't correct |
88 |
Incorrect |
281 ms |
129092 KB |
Output isn't correct |
89 |
Incorrect |
298 ms |
129092 KB |
Output isn't correct |
90 |
Incorrect |
178 ms |
82852 KB |
Output isn't correct |
91 |
Incorrect |
284 ms |
129132 KB |
Output isn't correct |
92 |
Incorrect |
317 ms |
129140 KB |
Output isn't correct |
93 |
Incorrect |
324 ms |
129128 KB |
Output isn't correct |
94 |
Incorrect |
294 ms |
129248 KB |
Output isn't correct |
95 |
Incorrect |
278 ms |
129112 KB |
Output isn't correct |
96 |
Incorrect |
285 ms |
129132 KB |
Output isn't correct |
97 |
Incorrect |
341 ms |
129184 KB |
Output isn't correct |
98 |
Incorrect |
279 ms |
129176 KB |
Output isn't correct |
99 |
Incorrect |
311 ms |
129132 KB |
Output isn't correct |
100 |
Incorrect |
332 ms |
129180 KB |
Output isn't correct |