# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
334315 |
2020-12-09T02:31:48 Z |
beksultan04 |
Bomb (IZhO17_bomb) |
C++14 |
|
463 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 = 1e5+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 |
364 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
3 |
Incorrect |
16 ms |
30572 KB |
Output isn't correct |
4 |
Incorrect |
16 ms |
30572 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Incorrect |
1 ms |
492 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 |
620 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 |
1132 KB |
Output isn't correct |
18 |
Correct |
1 ms |
1004 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 |
1260 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 |
9 ms |
5740 KB |
Output isn't correct |
28 |
Incorrect |
9 ms |
2796 KB |
Output isn't correct |
29 |
Incorrect |
12 ms |
7532 KB |
Output isn't correct |
30 |
Incorrect |
16 ms |
6636 KB |
Output isn't correct |
31 |
Correct |
12 ms |
4972 KB |
Output is correct |
32 |
Incorrect |
13 ms |
6144 KB |
Output isn't correct |
33 |
Incorrect |
18 ms |
8044 KB |
Output isn't correct |
34 |
Incorrect |
7 ms |
2924 KB |
Output isn't correct |
35 |
Incorrect |
16 ms |
4332 KB |
Output isn't correct |
36 |
Incorrect |
19 ms |
10476 KB |
Output isn't correct |
37 |
Incorrect |
1 ms |
620 KB |
Output isn't correct |
38 |
Runtime error |
448 ms |
131072 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
39 |
Incorrect |
1 ms |
640 KB |
Output isn't correct |
40 |
Incorrect |
65 ms |
29036 KB |
Output isn't correct |
41 |
Correct |
1 ms |
620 KB |
Output is correct |
42 |
Correct |
2 ms |
1772 KB |
Output is correct |
43 |
Correct |
457 ms |
129516 KB |
Output is correct |
44 |
Correct |
18 ms |
9344 KB |
Output is correct |
45 |
Incorrect |
459 ms |
128236 KB |
Output isn't correct |
46 |
Runtime error |
456 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
47 |
Incorrect |
459 ms |
128492 KB |
Output isn't correct |
48 |
Incorrect |
460 ms |
130540 KB |
Output isn't correct |
49 |
Runtime error |
447 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
50 |
Runtime error |
461 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
51 |
Incorrect |
461 ms |
129132 KB |
Output isn't correct |
52 |
Incorrect |
460 ms |
129516 KB |
Output isn't correct |
53 |
Incorrect |
463 ms |
126444 KB |
Output isn't correct |
54 |
Incorrect |
449 ms |
106348 KB |
Output isn't correct |
55 |
Incorrect |
447 ms |
102636 KB |
Output isn't correct |
56 |
Runtime error |
456 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
57 |
Incorrect |
446 ms |
91628 KB |
Output isn't correct |
58 |
Incorrect |
444 ms |
97532 KB |
Output isn't correct |
59 |
Incorrect |
445 ms |
93704 KB |
Output isn't correct |
60 |
Correct |
454 ms |
117228 KB |
Output is correct |
61 |
Runtime error |
456 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
62 |
Runtime error |
451 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
63 |
Runtime error |
450 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
64 |
Correct |
443 ms |
94976 KB |
Output is correct |
65 |
Correct |
459 ms |
125036 KB |
Output is correct |
66 |
Incorrect |
456 ms |
120684 KB |
Output isn't correct |
67 |
Runtime error |
449 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
68 |
Runtime error |
445 ms |
131072 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
69 |
Incorrect |
445 ms |
91500 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 |
439 ms |
88940 KB |
Output isn't correct |
73 |
Correct |
443 ms |
91372 KB |
Output is correct |
74 |
Incorrect |
442 ms |
91372 KB |
Output isn't correct |
75 |
Incorrect |
444 ms |
93804 KB |
Output isn't correct |
76 |
Incorrect |
446 ms |
95980 KB |
Output isn't correct |
77 |
Incorrect |
444 ms |
97516 KB |
Output isn't correct |
78 |
Incorrect |
448 ms |
97388 KB |
Output isn't correct |
79 |
Incorrect |
422 ms |
54656 KB |
Output isn't correct |
80 |
Incorrect |
421 ms |
56044 KB |
Output isn't correct |
81 |
Incorrect |
425 ms |
57964 KB |
Output isn't correct |
82 |
Incorrect |
442 ms |
100844 KB |
Output isn't correct |
83 |
Incorrect |
446 ms |
100904 KB |
Output isn't correct |
84 |
Incorrect |
417 ms |
50028 KB |
Output isn't correct |
85 |
Incorrect |
445 ms |
98040 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 |
440 ms |
95852 KB |
Output isn't correct |
88 |
Correct |
446 ms |
99888 KB |
Output is correct |
89 |
Correct |
453 ms |
116332 KB |
Output is correct |
90 |
Incorrect |
289 ms |
72044 KB |
Output isn't correct |
91 |
Incorrect |
449 ms |
105580 KB |
Output isn't correct |
92 |
Incorrect |
453 ms |
116716 KB |
Output isn't correct |
93 |
Runtime error |
442 ms |
131072 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
94 |
Correct |
455 ms |
116716 KB |
Output is correct |
95 |
Incorrect |
449 ms |
100972 KB |
Output isn't correct |
96 |
Correct |
446 ms |
100716 KB |
Output is correct |
97 |
Runtime error |
450 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
98 |
Incorrect |
446 ms |
100576 KB |
Output isn't correct |
99 |
Incorrect |
452 ms |
114924 KB |
Output isn't correct |
100 |
Runtime error |
450 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |