# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
341001 |
2020-12-28T21:07:00 Z |
Tosic |
Bomb (IZhO17_bomb) |
C++14 |
|
181 ms |
80244 KB |
#include <bits/stdc++.h>
#define maxn 2510
using namespace std;
int n, m, ans, dp[maxn];
int a[maxn][maxn], up[maxn][maxn], down[maxn][maxn];
int main(){
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
cin >> n >> m;
for(int i = 0; i < n; ++i){
dp[i+1] = 1e9;
for(int j = 0; j < m; ++j){
char tmpC;
cin >>tmpC;
a[i][j] = tmpC-'0';
}
}
for(int i = 0; i < n; ++i){
for(int j = 0; j < m; ++j){
if(a[i][j]){
up[i][j] = 1;
if(i){
up[i][j] += up[i-1][j];
}
}
}
}
int tmp=n;
for(int i = n-1; i >= 0; --i){
for(int j = 0; j < m; ++j){
if(a[i][j]){
down[i][j] = 1 + down[i+1][j];
}
}
}
for(int i = 0; i < n; ++i){
for(int j = 0; j < m; ++j){
if(!a[i][j]){
continue;
}
int frJ = j, ln = 1, maxUp = up[i][j], maxD = down[i][j];
dp[1] = min(dp[1], maxUp+maxD-1);
while(a[i][j+1]){
++j;
++ln;
maxUp = min(maxUp, up[i][j]);
maxD = min(maxD, down[i][j]);
dp[ln] = min(dp[ln], maxUp+maxD-1);
}
maxUp = 1e9, maxD = 1e9;
ln = 1;
for(int k = j; k >= frJ; --k){
maxD = min(maxD, down[i][k]);
maxUp = min(maxUp, up[i][k]);
dp[ln] = min(dp[ln], maxUp+maxD-1);
++ln;
}
tmp = min(tmp, abs(frJ-j)+1);
}
}
for(int i = 1; i <= tmp; ++i){
ans = max(ans, i*dp[i]);
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
14 ms |
30464 KB |
Output is correct |
4 |
Correct |
14 ms |
30444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
8 |
Correct |
1 ms |
492 KB |
Output is correct |
9 |
Correct |
1 ms |
492 KB |
Output is correct |
10 |
Correct |
1 ms |
492 KB |
Output is correct |
11 |
Correct |
1 ms |
620 KB |
Output is correct |
12 |
Correct |
1 ms |
492 KB |
Output is correct |
13 |
Correct |
1 ms |
492 KB |
Output is correct |
14 |
Correct |
1 ms |
492 KB |
Output is correct |
15 |
Correct |
1 ms |
492 KB |
Output is correct |
16 |
Correct |
1 ms |
620 KB |
Output is correct |
17 |
Correct |
1 ms |
1132 KB |
Output is correct |
18 |
Correct |
1 ms |
1004 KB |
Output is correct |
19 |
Correct |
1 ms |
1260 KB |
Output is correct |
20 |
Correct |
1 ms |
1260 KB |
Output is correct |
21 |
Correct |
1 ms |
748 KB |
Output is correct |
22 |
Correct |
1 ms |
1004 KB |
Output is correct |
23 |
Correct |
2 ms |
1260 KB |
Output is correct |
24 |
Correct |
1 ms |
1132 KB |
Output is correct |
25 |
Correct |
1 ms |
1516 KB |
Output is correct |
26 |
Incorrect |
1 ms |
1644 KB |
Output isn't correct |
27 |
Incorrect |
5 ms |
4972 KB |
Output isn't correct |
28 |
Correct |
4 ms |
2540 KB |
Output is correct |
29 |
Correct |
6 ms |
6380 KB |
Output is correct |
30 |
Correct |
7 ms |
5740 KB |
Output is correct |
31 |
Correct |
5 ms |
4332 KB |
Output is correct |
32 |
Correct |
6 ms |
5484 KB |
Output is correct |
33 |
Correct |
8 ms |
7020 KB |
Output is correct |
34 |
Correct |
4 ms |
2668 KB |
Output is correct |
35 |
Correct |
6 ms |
3692 KB |
Output is correct |
36 |
Incorrect |
9 ms |
8300 KB |
Output isn't correct |
37 |
Correct |
1 ms |
620 KB |
Output is correct |
38 |
Correct |
179 ms |
80108 KB |
Output is correct |
39 |
Correct |
1 ms |
620 KB |
Output is correct |
40 |
Correct |
27 ms |
20716 KB |
Output is correct |
41 |
Correct |
1 ms |
620 KB |
Output is correct |
42 |
Correct |
1 ms |
1644 KB |
Output is correct |
43 |
Correct |
167 ms |
76396 KB |
Output is correct |
44 |
Correct |
8 ms |
7788 KB |
Output is correct |
45 |
Correct |
166 ms |
77548 KB |
Output is correct |
46 |
Correct |
169 ms |
80108 KB |
Output is correct |
47 |
Correct |
169 ms |
77676 KB |
Output is correct |
48 |
Correct |
171 ms |
80108 KB |
Output is correct |
49 |
Incorrect |
174 ms |
80236 KB |
Output isn't correct |
50 |
Correct |
167 ms |
80236 KB |
Output is correct |
51 |
Correct |
167 ms |
80236 KB |
Output is correct |
52 |
Correct |
169 ms |
80108 KB |
Output is correct |
53 |
Correct |
167 ms |
79468 KB |
Output is correct |
54 |
Correct |
154 ms |
66796 KB |
Output is correct |
55 |
Correct |
154 ms |
65004 KB |
Output is correct |
56 |
Correct |
178 ms |
80236 KB |
Output is correct |
57 |
Correct |
151 ms |
60140 KB |
Output is correct |
58 |
Correct |
155 ms |
65188 KB |
Output is correct |
59 |
Correct |
152 ms |
62060 KB |
Output is correct |
60 |
Incorrect |
161 ms |
71916 KB |
Output isn't correct |
61 |
Incorrect |
178 ms |
80244 KB |
Output isn't correct |
62 |
Incorrect |
173 ms |
80108 KB |
Output isn't correct |
63 |
Incorrect |
173 ms |
80128 KB |
Output isn't correct |
64 |
Incorrect |
154 ms |
62956 KB |
Output isn't correct |
65 |
Correct |
166 ms |
79084 KB |
Output is correct |
66 |
Correct |
164 ms |
76012 KB |
Output is correct |
67 |
Correct |
168 ms |
80108 KB |
Output is correct |
68 |
Correct |
169 ms |
80108 KB |
Output is correct |
69 |
Correct |
149 ms |
59628 KB |
Output is correct |
70 |
Correct |
92 ms |
33900 KB |
Output is correct |
71 |
Correct |
147 ms |
52716 KB |
Output is correct |
72 |
Correct |
152 ms |
58220 KB |
Output is correct |
73 |
Correct |
149 ms |
58604 KB |
Output is correct |
74 |
Correct |
153 ms |
60140 KB |
Output is correct |
75 |
Correct |
154 ms |
61804 KB |
Output is correct |
76 |
Correct |
151 ms |
63100 KB |
Output is correct |
77 |
Correct |
154 ms |
63596 KB |
Output is correct |
78 |
Correct |
155 ms |
63852 KB |
Output is correct |
79 |
Correct |
133 ms |
36332 KB |
Output is correct |
80 |
Correct |
135 ms |
37612 KB |
Output is correct |
81 |
Correct |
137 ms |
37984 KB |
Output is correct |
82 |
Correct |
163 ms |
66284 KB |
Output is correct |
83 |
Correct |
158 ms |
66540 KB |
Output is correct |
84 |
Correct |
134 ms |
31640 KB |
Output is correct |
85 |
Correct |
158 ms |
65516 KB |
Output is correct |
86 |
Correct |
177 ms |
78956 KB |
Output is correct |
87 |
Correct |
158 ms |
64364 KB |
Output is correct |
88 |
Correct |
159 ms |
65260 KB |
Output is correct |
89 |
Correct |
168 ms |
74080 KB |
Output is correct |
90 |
Correct |
104 ms |
48108 KB |
Output is correct |
91 |
Correct |
160 ms |
69356 KB |
Output is correct |
92 |
Correct |
171 ms |
71020 KB |
Output is correct |
93 |
Correct |
181 ms |
78132 KB |
Output is correct |
94 |
Correct |
167 ms |
72684 KB |
Output is correct |
95 |
Correct |
162 ms |
66540 KB |
Output is correct |
96 |
Correct |
158 ms |
66284 KB |
Output is correct |
97 |
Correct |
176 ms |
78924 KB |
Output is correct |
98 |
Correct |
155 ms |
66028 KB |
Output is correct |
99 |
Correct |
161 ms |
72428 KB |
Output is correct |
100 |
Correct |
173 ms |
77648 KB |
Output is correct |