# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
37842 |
2017-12-28T09:48:23 Z |
alenam0161 |
Bomb (IZhO17_bomb) |
C++14 |
|
469 ms |
63304 KB |
#include<bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
char c1[2505][2505],c2[2505][2505];
int n,m,l,r,bolo;
int lf[2505][2505],rg[2505][ 2505],zr[2505];
pair<int, int> ans;
int main(){
// freopen("bomb.in","r",stdin);
// freopen("bomb.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;++i) scanf("%s", &c1[i][1]);
for(int i=0;i<2505;++i) zr[i] = inf;
for(int i=0;i<1;++i) {
memset((lf), 0, sizeof(lf));
memset((rg), 0, sizeof(rg));
for(int i=1;i<=n;++i){
for(int j=1;j<=m;++j)
if(c1[i][j] == '1') lf[i][j] = lf[i][j-1] + 1;
for(int j=m;j>=1;--j)
if(c1[i][j] == '1') rg[i][j] = rg[i][j+1] + 1;
for(int j=1;j<=m;++j)
if(c1[i][j] == '1' && c1[i][j+1] != '1') zr[1] = min(zr[1], lf[i][j]);
}
/*
5 6
001000
101110
111110
111110
000100
*/
for(int j=1;j<=m;++j)
for(int i=0;i<=n+1;++i)
{
if(c1[i][j] == '1') {
l = min(l, lf[i][j]); r = min(r, rg[i][j]);
zr[i - bolo] = min(zr[i - bolo], l + r - 1);
} else {
if(i && bolo != i-1) zr[i - bolo] = 0;
l = inf; r = inf; bolo = i;
}
}
for(int i=1;i<=n;++i)
for(int j=1;j<=m;++j)
c2[i][j] = c1[n+1-i][j];
for(int i=1;i<=n;++i)
for(int j=1;j<=m;++j)
c1[i][j] = c2[i][j];
}
int b = inf;
for(int a=1;a<=2504;++a) {
b = min(b, zr[a]);
ans = max(ans, {a*b, b});
}
cout << ans.first<< endl;
}
Compilation message
bomb.cpp: In function 'int main()':
bomb.cpp:12:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&n,&m);
^
bomb.cpp:13:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(int i=1;i<=n;++i) scanf("%s", &c1[i][1]);
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
63304 KB |
Output is correct |
2 |
Correct |
0 ms |
63304 KB |
Output is correct |
3 |
Correct |
9 ms |
63304 KB |
Output is correct |
4 |
Correct |
9 ms |
63304 KB |
Output is correct |
5 |
Correct |
6 ms |
63304 KB |
Output is correct |
6 |
Correct |
0 ms |
63304 KB |
Output is correct |
7 |
Correct |
9 ms |
63304 KB |
Output is correct |
8 |
Correct |
3 ms |
63304 KB |
Output is correct |
9 |
Incorrect |
6 ms |
63304 KB |
Output isn't correct |
10 |
Correct |
9 ms |
63304 KB |
Output is correct |
11 |
Incorrect |
3 ms |
63304 KB |
Output isn't correct |
12 |
Correct |
3 ms |
63304 KB |
Output is correct |
13 |
Correct |
6 ms |
63304 KB |
Output is correct |
14 |
Correct |
9 ms |
63304 KB |
Output is correct |
15 |
Correct |
9 ms |
63304 KB |
Output is correct |
16 |
Correct |
6 ms |
63304 KB |
Output is correct |
17 |
Correct |
0 ms |
63304 KB |
Output is correct |
18 |
Correct |
3 ms |
63304 KB |
Output is correct |
19 |
Incorrect |
9 ms |
63304 KB |
Output isn't correct |
20 |
Correct |
3 ms |
63304 KB |
Output is correct |
21 |
Correct |
0 ms |
63304 KB |
Output is correct |
22 |
Correct |
0 ms |
63304 KB |
Output is correct |
23 |
Incorrect |
3 ms |
63304 KB |
Output isn't correct |
24 |
Incorrect |
6 ms |
63304 KB |
Output isn't correct |
25 |
Correct |
0 ms |
63304 KB |
Output is correct |
26 |
Correct |
3 ms |
63304 KB |
Output is correct |
27 |
Correct |
6 ms |
63304 KB |
Output is correct |
28 |
Correct |
3 ms |
63304 KB |
Output is correct |
29 |
Correct |
3 ms |
63304 KB |
Output is correct |
30 |
Incorrect |
9 ms |
63304 KB |
Output isn't correct |
31 |
Incorrect |
9 ms |
63304 KB |
Output isn't correct |
32 |
Incorrect |
13 ms |
63304 KB |
Output isn't correct |
33 |
Correct |
0 ms |
63304 KB |
Output is correct |
34 |
Correct |
3 ms |
63304 KB |
Output is correct |
35 |
Incorrect |
3 ms |
63304 KB |
Output isn't correct |
36 |
Correct |
9 ms |
63304 KB |
Output is correct |
37 |
Incorrect |
3 ms |
63304 KB |
Output isn't correct |
38 |
Correct |
436 ms |
63304 KB |
Output is correct |
39 |
Incorrect |
3 ms |
63304 KB |
Output isn't correct |
40 |
Correct |
39 ms |
63304 KB |
Output is correct |
41 |
Correct |
6 ms |
63304 KB |
Output is correct |
42 |
Correct |
3 ms |
63304 KB |
Output is correct |
43 |
Correct |
356 ms |
63304 KB |
Output is correct |
44 |
Correct |
9 ms |
63304 KB |
Output is correct |
45 |
Incorrect |
346 ms |
63304 KB |
Output isn't correct |
46 |
Correct |
269 ms |
63304 KB |
Output is correct |
47 |
Incorrect |
326 ms |
63304 KB |
Output isn't correct |
48 |
Correct |
316 ms |
63304 KB |
Output is correct |
49 |
Correct |
469 ms |
63304 KB |
Output is correct |
50 |
Correct |
313 ms |
63304 KB |
Output is correct |
51 |
Correct |
276 ms |
63304 KB |
Output is correct |
52 |
Correct |
286 ms |
63304 KB |
Output is correct |
53 |
Correct |
299 ms |
63304 KB |
Output is correct |
54 |
Correct |
246 ms |
63304 KB |
Output is correct |
55 |
Correct |
189 ms |
63304 KB |
Output is correct |
56 |
Correct |
409 ms |
63304 KB |
Output is correct |
57 |
Correct |
189 ms |
63304 KB |
Output is correct |
58 |
Correct |
216 ms |
63304 KB |
Output is correct |
59 |
Correct |
173 ms |
63304 KB |
Output is correct |
60 |
Correct |
279 ms |
63304 KB |
Output is correct |
61 |
Correct |
426 ms |
63304 KB |
Output is correct |
62 |
Correct |
443 ms |
63304 KB |
Output is correct |
63 |
Correct |
423 ms |
63304 KB |
Output is correct |
64 |
Correct |
193 ms |
63304 KB |
Output is correct |
65 |
Correct |
296 ms |
63304 KB |
Output is correct |
66 |
Correct |
276 ms |
63304 KB |
Output is correct |
67 |
Correct |
303 ms |
63304 KB |
Output is correct |
68 |
Correct |
313 ms |
63304 KB |
Output is correct |
69 |
Correct |
189 ms |
63304 KB |
Output is correct |
70 |
Incorrect |
66 ms |
63304 KB |
Output isn't correct |
71 |
Incorrect |
139 ms |
63304 KB |
Output isn't correct |
72 |
Correct |
173 ms |
63304 KB |
Output is correct |
73 |
Incorrect |
179 ms |
63304 KB |
Output isn't correct |
74 |
Incorrect |
163 ms |
63304 KB |
Output isn't correct |
75 |
Incorrect |
179 ms |
63304 KB |
Output isn't correct |
76 |
Correct |
176 ms |
63304 KB |
Output is correct |
77 |
Correct |
183 ms |
63304 KB |
Output is correct |
78 |
Correct |
186 ms |
63304 KB |
Output is correct |
79 |
Incorrect |
83 ms |
63304 KB |
Output isn't correct |
80 |
Incorrect |
79 ms |
63304 KB |
Output isn't correct |
81 |
Incorrect |
103 ms |
63304 KB |
Output isn't correct |
82 |
Correct |
206 ms |
63304 KB |
Output is correct |
83 |
Incorrect |
186 ms |
63304 KB |
Output isn't correct |
84 |
Incorrect |
96 ms |
63304 KB |
Output isn't correct |
85 |
Incorrect |
166 ms |
63304 KB |
Output isn't correct |
86 |
Incorrect |
379 ms |
63304 KB |
Output isn't correct |
87 |
Correct |
183 ms |
63304 KB |
Output is correct |
88 |
Incorrect |
186 ms |
63304 KB |
Output isn't correct |
89 |
Incorrect |
246 ms |
63304 KB |
Output isn't correct |
90 |
Incorrect |
86 ms |
63304 KB |
Output isn't correct |
91 |
Correct |
203 ms |
63304 KB |
Output is correct |
92 |
Correct |
246 ms |
63304 KB |
Output is correct |
93 |
Correct |
386 ms |
63304 KB |
Output is correct |
94 |
Incorrect |
246 ms |
63304 KB |
Output isn't correct |
95 |
Incorrect |
209 ms |
63304 KB |
Output isn't correct |
96 |
Incorrect |
203 ms |
63304 KB |
Output isn't correct |
97 |
Correct |
356 ms |
63304 KB |
Output is correct |
98 |
Correct |
219 ms |
63304 KB |
Output is correct |
99 |
Incorrect |
216 ms |
63304 KB |
Output isn't correct |
100 |
Incorrect |
336 ms |
63304 KB |
Output isn't correct |