# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
936112 |
2024-03-01T07:02:31 Z |
guagua0407 |
Bomb (IZhO17_bomb) |
C++17 |
|
1000 ms |
43700 KB |
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define all(x) x.begin(),x.end()
const int mxn=2505;
char c[mxn][mxn];
int pre[mxn][mxn];
bool used[mxn][mxn];
int mn[mxn];
int n,m;
bool check(int x,int y){
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
used[i][j]=false;
}
}
for(int j=1;j<=m;j++){
mn[j]=0;
}
int cur=0;
for(int i=y;i<=n;i++){
int prv=0;
for(int j=x;j<=m;j++){
int sum=pre[i][j]-pre[i][j-x]-pre[i-y][j]+pre[i-y][j-x];
if(sum!=x*y){
continue;
}
for(int k=max(prv+1,j-x+1);k<=j;k++){
for(int l=i;l>=max(mn[k]+1,i-y+1);l--){
used[l][k]=true;
cur++;
}
mn[k]=i;
}
prv=j;
}
}
return cur==pre[n][m];
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
auto st=clock();
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>c[i][j];
pre[i][j]=pre[i][j-1]+pre[i-1][j]-pre[i-1][j-1]+(c[i][j]=='1');
}
}
int ans=1;
set<int> S;
for(int len=m;len>=1;len--){
int r=(ans+len-1)/len;
while(r<=n and check(len,r)){
r++;
}
S.insert(r);
ans=max(ans,len*(r-1));
}
assert(S.size()<100);
cout<<ans<<'\n';
}
Compilation message
bomb.cpp: In function 'int main()':
bomb.cpp:49:10: warning: unused variable 'st' [-Wunused-variable]
49 | auto st=clock();
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2520 KB |
Output is correct |
3 |
Correct |
12 ms |
23640 KB |
Output is correct |
4 |
Correct |
11 ms |
23644 KB |
Output is correct |
5 |
Correct |
8 ms |
2548 KB |
Output is correct |
6 |
Correct |
3 ms |
2392 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2648 KB |
Output is correct |
9 |
Correct |
1 ms |
2816 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2512 KB |
Output is correct |
16 |
Correct |
1 ms |
2524 KB |
Output is correct |
17 |
Correct |
1 ms |
2908 KB |
Output is correct |
18 |
Correct |
1 ms |
4956 KB |
Output is correct |
19 |
Correct |
2 ms |
4956 KB |
Output is correct |
20 |
Correct |
2 ms |
4956 KB |
Output is correct |
21 |
Correct |
1 ms |
2652 KB |
Output is correct |
22 |
Correct |
1 ms |
4956 KB |
Output is correct |
23 |
Correct |
2 ms |
4956 KB |
Output is correct |
24 |
Correct |
1 ms |
4956 KB |
Output is correct |
25 |
Correct |
2 ms |
4956 KB |
Output is correct |
26 |
Correct |
6 ms |
5196 KB |
Output is correct |
27 |
Correct |
63 ms |
8280 KB |
Output is correct |
28 |
Correct |
30 ms |
8420 KB |
Output is correct |
29 |
Correct |
107 ms |
8792 KB |
Output is correct |
30 |
Correct |
81 ms |
9436 KB |
Output is correct |
31 |
Correct |
58 ms |
8796 KB |
Output is correct |
32 |
Correct |
47 ms |
9052 KB |
Output is correct |
33 |
Correct |
88 ms |
11356 KB |
Output is correct |
34 |
Correct |
19 ms |
8540 KB |
Output is correct |
35 |
Correct |
65 ms |
11548 KB |
Output is correct |
36 |
Correct |
466 ms |
11536 KB |
Output is correct |
37 |
Correct |
1 ms |
2652 KB |
Output is correct |
38 |
Execution timed out |
1016 ms |
43344 KB |
Time limit exceeded |
39 |
Correct |
1 ms |
2652 KB |
Output is correct |
40 |
Execution timed out |
1075 ms |
14552 KB |
Time limit exceeded |
41 |
Correct |
1 ms |
2652 KB |
Output is correct |
42 |
Correct |
3 ms |
4952 KB |
Output is correct |
43 |
Execution timed out |
1084 ms |
43252 KB |
Time limit exceeded |
44 |
Runtime error |
164 ms |
22864 KB |
Execution killed with signal 6 |
45 |
Execution timed out |
1026 ms |
43116 KB |
Time limit exceeded |
46 |
Execution timed out |
1050 ms |
43384 KB |
Time limit exceeded |
47 |
Execution timed out |
1063 ms |
43256 KB |
Time limit exceeded |
48 |
Execution timed out |
1103 ms |
43236 KB |
Time limit exceeded |
49 |
Execution timed out |
1044 ms |
43284 KB |
Time limit exceeded |
50 |
Execution timed out |
1030 ms |
43700 KB |
Time limit exceeded |
51 |
Execution timed out |
1050 ms |
43348 KB |
Time limit exceeded |
52 |
Execution timed out |
1063 ms |
43144 KB |
Time limit exceeded |
53 |
Execution timed out |
1091 ms |
43344 KB |
Time limit exceeded |
54 |
Execution timed out |
1058 ms |
43348 KB |
Time limit exceeded |
55 |
Execution timed out |
1012 ms |
43156 KB |
Time limit exceeded |
56 |
Execution timed out |
1052 ms |
43348 KB |
Time limit exceeded |
57 |
Execution timed out |
1032 ms |
43164 KB |
Time limit exceeded |
58 |
Execution timed out |
1010 ms |
43284 KB |
Time limit exceeded |
59 |
Execution timed out |
1052 ms |
43184 KB |
Time limit exceeded |
60 |
Execution timed out |
1018 ms |
43152 KB |
Time limit exceeded |
61 |
Execution timed out |
1025 ms |
43204 KB |
Time limit exceeded |
62 |
Execution timed out |
1029 ms |
43144 KB |
Time limit exceeded |
63 |
Execution timed out |
1057 ms |
43348 KB |
Time limit exceeded |
64 |
Execution timed out |
1016 ms |
43344 KB |
Time limit exceeded |
65 |
Execution timed out |
1024 ms |
43248 KB |
Time limit exceeded |
66 |
Execution timed out |
1033 ms |
43348 KB |
Time limit exceeded |
67 |
Execution timed out |
1036 ms |
43196 KB |
Time limit exceeded |
68 |
Execution timed out |
1091 ms |
43140 KB |
Time limit exceeded |
69 |
Execution timed out |
1046 ms |
43352 KB |
Time limit exceeded |
70 |
Execution timed out |
1055 ms |
36440 KB |
Time limit exceeded |
71 |
Execution timed out |
1040 ms |
43348 KB |
Time limit exceeded |
72 |
Execution timed out |
1047 ms |
43348 KB |
Time limit exceeded |
73 |
Execution timed out |
1025 ms |
43256 KB |
Time limit exceeded |
74 |
Execution timed out |
1008 ms |
43344 KB |
Time limit exceeded |
75 |
Execution timed out |
1010 ms |
43344 KB |
Time limit exceeded |
76 |
Execution timed out |
1008 ms |
43120 KB |
Time limit exceeded |
77 |
Execution timed out |
1031 ms |
43144 KB |
Time limit exceeded |
78 |
Execution timed out |
1030 ms |
43240 KB |
Time limit exceeded |
79 |
Execution timed out |
1014 ms |
43268 KB |
Time limit exceeded |
80 |
Execution timed out |
1031 ms |
43272 KB |
Time limit exceeded |
81 |
Execution timed out |
1060 ms |
43232 KB |
Time limit exceeded |
82 |
Execution timed out |
1026 ms |
43256 KB |
Time limit exceeded |
83 |
Execution timed out |
1046 ms |
43348 KB |
Time limit exceeded |
84 |
Execution timed out |
1033 ms |
43404 KB |
Time limit exceeded |
85 |
Execution timed out |
1030 ms |
43348 KB |
Time limit exceeded |
86 |
Execution timed out |
1027 ms |
43216 KB |
Time limit exceeded |
87 |
Execution timed out |
1051 ms |
43128 KB |
Time limit exceeded |
88 |
Execution timed out |
1066 ms |
43348 KB |
Time limit exceeded |
89 |
Execution timed out |
1100 ms |
43248 KB |
Time limit exceeded |
90 |
Execution timed out |
1043 ms |
36480 KB |
Time limit exceeded |
91 |
Execution timed out |
1004 ms |
43344 KB |
Time limit exceeded |
92 |
Execution timed out |
1050 ms |
43152 KB |
Time limit exceeded |
93 |
Execution timed out |
1066 ms |
43348 KB |
Time limit exceeded |
94 |
Execution timed out |
1064 ms |
43352 KB |
Time limit exceeded |
95 |
Execution timed out |
1035 ms |
43144 KB |
Time limit exceeded |
96 |
Execution timed out |
1059 ms |
43240 KB |
Time limit exceeded |
97 |
Execution timed out |
1060 ms |
43120 KB |
Time limit exceeded |
98 |
Execution timed out |
1049 ms |
43236 KB |
Time limit exceeded |
99 |
Execution timed out |
1049 ms |
43348 KB |
Time limit exceeded |
100 |
Execution timed out |
1070 ms |
43152 KB |
Time limit exceeded |