# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
334314 |
2020-12-09T02:30:02 Z |
beksultan04 |
Bomb (IZhO17_bomb) |
C++14 |
|
465 ms |
131076 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define fr first
#define sc second
#define ret return
#define scan1(a) scanf("%lld",&a);
#define scan2(a,b) scanf("%lld %lld",&a, &b);
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define pb push_back
#define endi puts("");
const int N = 1e6+12,INF=1e9+7;
int q[2501][2501],dp[N],up[2501][2501],down[2501][2501],ans[N];
main(){
int n,m,i,j,X=INF,Y=INF;
scan2(n,m)
for (i=1;i<=n;++i)
for (j=1;j<=m;++j){
char ch;
cin>>ch;
q[i][j]=ch-'0';
}
for (i=1;i<=n;++i){
for (j=1;j<=m;++j){
if (q[i][j]){
up[i][j] = 1+up[i-1][j];
if (q[i+1][j] == 0)Y = min(Y,up[i][j]);
}
}
}
for (i=n;i>0;--i){
for (j=m;j>0;--j){
if (q[i][j]){
down[i][j] = 1+down[i+1][j];
if (q[i-1][j] == 0)X = min(X,down[i][j]);
}
}
}
/// /// /// ///
for (i=1;i<=Y;++i){
ans[i]=X;
}
for (i=1;i<=n;++i){
int a=INF,b=INF,c=0;
for (j=1;j<=m;++j){
if (q[i][j] == 0){
if (c != 0)
X = min(X,c);
a=b=INF;
c=0;
}
else {
a = min(a,down[i][j]);
b = min(b,up[i][j]);
c++;
ans[c] = min(ans[c],b+a-1);
}
}
}
/// /// /// ///
int mx = 0;
for (i=1;i<=X;++i){
mx = max(mx,ans[i]*i);
}
cout <<mx;
}
Compilation message
bomb.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
18 | main(){
| ^
bomb.cpp: In function 'int main()':
bomb.cpp:10:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
10 | #define scan2(a,b) scanf("%lld %lld",&a, &b);
| ~~~~~^~~~~~~~~~~~~~~~~~~~
bomb.cpp:20:5: note: in expansion of macro 'scan2'
20 | scan2(n,m)
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
372 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
3 |
Incorrect |
16 ms |
30592 KB |
Output isn't correct |
4 |
Incorrect |
16 ms |
30592 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
10 |
Correct |
1 ms |
492 KB |
Output is correct |
11 |
Correct |
1 ms |
640 KB |
Output is correct |
12 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
14 |
Correct |
1 ms |
492 KB |
Output is correct |
15 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
620 KB |
Output isn't correct |
17 |
Incorrect |
1 ms |
1152 KB |
Output isn't correct |
18 |
Correct |
1 ms |
876 KB |
Output is correct |
19 |
Incorrect |
1 ms |
1260 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
1260 KB |
Output isn't correct |
21 |
Correct |
1 ms |
748 KB |
Output is correct |
22 |
Correct |
1 ms |
1004 KB |
Output is correct |
23 |
Incorrect |
2 ms |
1388 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
1132 KB |
Output isn't correct |
25 |
Incorrect |
2 ms |
1644 KB |
Output isn't correct |
26 |
Correct |
2 ms |
1772 KB |
Output is correct |
27 |
Incorrect |
8 ms |
5740 KB |
Output isn't correct |
28 |
Incorrect |
9 ms |
2816 KB |
Output isn't correct |
29 |
Incorrect |
13 ms |
7552 KB |
Output isn't correct |
30 |
Incorrect |
16 ms |
6636 KB |
Output isn't correct |
31 |
Correct |
13 ms |
4972 KB |
Output is correct |
32 |
Incorrect |
14 ms |
6124 KB |
Output isn't correct |
33 |
Incorrect |
18 ms |
8044 KB |
Output isn't correct |
34 |
Incorrect |
8 ms |
2944 KB |
Output isn't correct |
35 |
Incorrect |
16 ms |
4332 KB |
Output isn't correct |
36 |
Incorrect |
20 ms |
10584 KB |
Output isn't correct |
37 |
Incorrect |
1 ms |
748 KB |
Output isn't correct |
38 |
Runtime error |
453 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
39 |
Incorrect |
1 ms |
620 KB |
Output isn't correct |
40 |
Incorrect |
65 ms |
29056 KB |
Output isn't correct |
41 |
Correct |
1 ms |
632 KB |
Output is correct |
42 |
Correct |
2 ms |
1772 KB |
Output is correct |
43 |
Correct |
456 ms |
129536 KB |
Output is correct |
44 |
Correct |
19 ms |
9324 KB |
Output is correct |
45 |
Incorrect |
462 ms |
128244 KB |
Output isn't correct |
46 |
Runtime error |
453 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
47 |
Incorrect |
463 ms |
128364 KB |
Output isn't correct |
48 |
Incorrect |
464 ms |
130668 KB |
Output isn't correct |
49 |
Runtime error |
458 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
50 |
Runtime error |
465 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
51 |
Incorrect |
462 ms |
129120 KB |
Output isn't correct |
52 |
Incorrect |
465 ms |
129516 KB |
Output isn't correct |
53 |
Incorrect |
465 ms |
126444 KB |
Output isn't correct |
54 |
Incorrect |
451 ms |
106220 KB |
Output isn't correct |
55 |
Incorrect |
455 ms |
102636 KB |
Output isn't correct |
56 |
Runtime error |
457 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
57 |
Incorrect |
444 ms |
91628 KB |
Output isn't correct |
58 |
Incorrect |
447 ms |
97576 KB |
Output isn't correct |
59 |
Incorrect |
444 ms |
93548 KB |
Output isn't correct |
60 |
Correct |
454 ms |
117228 KB |
Output is correct |
61 |
Runtime error |
451 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
62 |
Runtime error |
454 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
63 |
Runtime error |
452 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
64 |
Correct |
444 ms |
95000 KB |
Output is correct |
65 |
Correct |
465 ms |
125036 KB |
Output is correct |
66 |
Incorrect |
456 ms |
120724 KB |
Output isn't correct |
67 |
Runtime error |
456 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
68 |
Runtime error |
454 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
69 |
Incorrect |
445 ms |
91256 KB |
Output isn't correct |
70 |
Incorrect |
281 ms |
52844 KB |
Output isn't correct |
71 |
Incorrect |
433 ms |
78828 KB |
Output isn't correct |
72 |
Incorrect |
442 ms |
88940 KB |
Output isn't correct |
73 |
Correct |
441 ms |
91224 KB |
Output is correct |
74 |
Incorrect |
442 ms |
91372 KB |
Output isn't correct |
75 |
Incorrect |
448 ms |
93804 KB |
Output isn't correct |
76 |
Incorrect |
444 ms |
95980 KB |
Output isn't correct |
77 |
Incorrect |
442 ms |
97388 KB |
Output isn't correct |
78 |
Incorrect |
442 ms |
97132 KB |
Output isn't correct |
79 |
Incorrect |
420 ms |
54764 KB |
Output isn't correct |
80 |
Incorrect |
425 ms |
56172 KB |
Output isn't correct |
81 |
Incorrect |
423 ms |
57836 KB |
Output isn't correct |
82 |
Incorrect |
449 ms |
101100 KB |
Output isn't correct |
83 |
Incorrect |
446 ms |
100800 KB |
Output isn't correct |
84 |
Incorrect |
421 ms |
50028 KB |
Output isn't correct |
85 |
Incorrect |
444 ms |
98156 KB |
Output isn't correct |
86 |
Runtime error |
452 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
87 |
Incorrect |
447 ms |
96000 KB |
Output isn't correct |
88 |
Correct |
445 ms |
99820 KB |
Output is correct |
89 |
Correct |
454 ms |
116332 KB |
Output is correct |
90 |
Incorrect |
290 ms |
72044 KB |
Output isn't correct |
91 |
Incorrect |
445 ms |
105552 KB |
Output isn't correct |
92 |
Incorrect |
453 ms |
116716 KB |
Output isn't correct |
93 |
Runtime error |
450 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
94 |
Correct |
453 ms |
116588 KB |
Output is correct |
95 |
Incorrect |
444 ms |
100972 KB |
Output isn't correct |
96 |
Correct |
451 ms |
100844 KB |
Output is correct |
97 |
Runtime error |
449 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
98 |
Incorrect |
446 ms |
100716 KB |
Output isn't correct |
99 |
Incorrect |
453 ms |
115084 KB |
Output isn't correct |
100 |
Runtime error |
453 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |