#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,dp[2509][2509],zx,xc,qw,we,k[2509][2509],pas,dd;
string s;
bool f[2509][2509];
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>b;
for(c=1; c<=a; c++){
cin>>s;
for(d=1; d<=b; d++){
f[c][d]=s[d-1]-'0';
}
}
for(c=1; c<=a; c++){
for(d=1; d<=b; d++) dp[c][d]=dp[c-1][d]+dp[c][d-1]-dp[c-1][d-1]+f[c][d];
}
d=b;
for(c=1; c<=a; c++){
while(d>=1){
// cout<<c<<" "<<d<<endl;
bool bo=0;
for(i=1; i<=a; i++) for(j=1; j<=b; j++) k[i][j]=0;
for(i=c; i<=a; i++){
for(j=d; j<=b; j++){
qw=i-c+1;we=j-d+1;
if(dp[i][j]-dp[i][we-1]-dp[qw-1][j]+dp[qw-1][we-1]==c*d){
k[qw][we]=1;
}
}
}
/* if(c==1&&d==5){
for(i=1; i<=a; i++){
for(j=1; j<=b; j++) cout<<k[i][j]<<" ";
cout<<endl;
}
}
if(c==1&&d==5) cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl;*/
for(i=1; i<=a; i++){
for(j=1; j<=b; j++) k[i][j]=k[i-1][j]+k[i][j-1]-k[i-1][j-1]+k[i][j];
}
/* if(c==1&&d==5){
for(i=1; i<=a; i++){
for(j=1; j<=b; j++) cout<<k[i][j]<<" ";
cout<<endl;
}
}*/
for(i=1; i<=a; i++){
if(bo==1) break;
for(j=1; j<=b; j++){
if(f[i][j]==0) continue;
qw=i-c+1;we=j-c+1;
if(qw<0) qw=0;
if(we<0) we=0;
int hj=0;
if(qw!=0&&we!=0) hj=k[i][j]-k[qw-1][j]-k[i][we-1]+k[qw-1][we-1]; else hj=k[i][j];
if(hj==0){
bo=1;
break;
}
}
}
if(bo==0){
if(pas<c*d) pas=c*d;
break;
}
d--;
}
}
cout<<pas;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
3 |
Incorrect |
105 ms |
26616 KB |
Output isn't correct |
4 |
Incorrect |
75 ms |
26620 KB |
Output isn't correct |
5 |
Incorrect |
31 ms |
504 KB |
Output isn't correct |
6 |
Incorrect |
7 ms |
376 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
508 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
504 KB |
Output isn't correct |
13 |
Incorrect |
2 ms |
600 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
504 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
504 KB |
Output isn't correct |
17 |
Incorrect |
5 ms |
1016 KB |
Output isn't correct |
18 |
Incorrect |
5 ms |
1272 KB |
Output isn't correct |
19 |
Incorrect |
7 ms |
1400 KB |
Output isn't correct |
20 |
Incorrect |
8 ms |
1400 KB |
Output isn't correct |
21 |
Incorrect |
6 ms |
888 KB |
Output isn't correct |
22 |
Incorrect |
11 ms |
1272 KB |
Output isn't correct |
23 |
Incorrect |
10 ms |
1552 KB |
Output isn't correct |
24 |
Incorrect |
6 ms |
1272 KB |
Output isn't correct |
25 |
Incorrect |
10 ms |
1528 KB |
Output isn't correct |
26 |
Incorrect |
16 ms |
1532 KB |
Output isn't correct |
27 |
Incorrect |
222 ms |
4188 KB |
Output isn't correct |
28 |
Incorrect |
213 ms |
4440 KB |
Output isn't correct |
29 |
Incorrect |
281 ms |
5756 KB |
Output isn't correct |
30 |
Incorrect |
548 ms |
6632 KB |
Output isn't correct |
31 |
Incorrect |
398 ms |
5240 KB |
Output isn't correct |
32 |
Incorrect |
402 ms |
6008 KB |
Output isn't correct |
33 |
Incorrect |
631 ms |
6904 KB |
Output isn't correct |
34 |
Incorrect |
102 ms |
4984 KB |
Output isn't correct |
35 |
Incorrect |
469 ms |
6904 KB |
Output isn't correct |
36 |
Execution timed out |
1051 ms |
6904 KB |
Time limit exceeded |
37 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
38 |
Execution timed out |
1050 ms |
61276 KB |
Time limit exceeded |
39 |
Incorrect |
7 ms |
632 KB |
Output isn't correct |
40 |
Execution timed out |
1014 ms |
16400 KB |
Time limit exceeded |
41 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
42 |
Incorrect |
13 ms |
1532 KB |
Output isn't correct |
43 |
Execution timed out |
1027 ms |
61416 KB |
Time limit exceeded |
44 |
Incorrect |
761 ms |
7032 KB |
Output isn't correct |
45 |
Execution timed out |
1093 ms |
60664 KB |
Time limit exceeded |
46 |
Execution timed out |
1052 ms |
60668 KB |
Time limit exceeded |
47 |
Execution timed out |
1043 ms |
61048 KB |
Time limit exceeded |
48 |
Execution timed out |
1065 ms |
60792 KB |
Time limit exceeded |
49 |
Execution timed out |
1065 ms |
60664 KB |
Time limit exceeded |
50 |
Execution timed out |
1080 ms |
60408 KB |
Time limit exceeded |
51 |
Execution timed out |
1078 ms |
60280 KB |
Time limit exceeded |
52 |
Execution timed out |
1054 ms |
60280 KB |
Time limit exceeded |
53 |
Execution timed out |
1018 ms |
59768 KB |
Time limit exceeded |
54 |
Execution timed out |
1050 ms |
60152 KB |
Time limit exceeded |
55 |
Execution timed out |
1058 ms |
60284 KB |
Time limit exceeded |
56 |
Execution timed out |
1022 ms |
60280 KB |
Time limit exceeded |
57 |
Execution timed out |
1053 ms |
60408 KB |
Time limit exceeded |
58 |
Execution timed out |
1052 ms |
60152 KB |
Time limit exceeded |
59 |
Execution timed out |
1056 ms |
60792 KB |
Time limit exceeded |
60 |
Execution timed out |
1045 ms |
60340 KB |
Time limit exceeded |
61 |
Execution timed out |
1032 ms |
60380 KB |
Time limit exceeded |
62 |
Execution timed out |
1065 ms |
60408 KB |
Time limit exceeded |
63 |
Execution timed out |
1030 ms |
60792 KB |
Time limit exceeded |
64 |
Execution timed out |
1087 ms |
60860 KB |
Time limit exceeded |
65 |
Execution timed out |
1041 ms |
60792 KB |
Time limit exceeded |
66 |
Execution timed out |
1006 ms |
60664 KB |
Time limit exceeded |
67 |
Execution timed out |
1061 ms |
60792 KB |
Time limit exceeded |
68 |
Execution timed out |
1034 ms |
60672 KB |
Time limit exceeded |
69 |
Execution timed out |
1039 ms |
60792 KB |
Time limit exceeded |
70 |
Execution timed out |
1029 ms |
48504 KB |
Time limit exceeded |
71 |
Execution timed out |
1028 ms |
60664 KB |
Time limit exceeded |
72 |
Execution timed out |
1063 ms |
60792 KB |
Time limit exceeded |
73 |
Execution timed out |
1072 ms |
60664 KB |
Time limit exceeded |
74 |
Execution timed out |
1078 ms |
60688 KB |
Time limit exceeded |
75 |
Execution timed out |
1048 ms |
60664 KB |
Time limit exceeded |
76 |
Execution timed out |
1038 ms |
60620 KB |
Time limit exceeded |
77 |
Execution timed out |
1067 ms |
60544 KB |
Time limit exceeded |
78 |
Execution timed out |
1012 ms |
60604 KB |
Time limit exceeded |
79 |
Execution timed out |
1053 ms |
60912 KB |
Time limit exceeded |
80 |
Execution timed out |
1016 ms |
60832 KB |
Time limit exceeded |
81 |
Execution timed out |
1081 ms |
60792 KB |
Time limit exceeded |
82 |
Execution timed out |
1038 ms |
60692 KB |
Time limit exceeded |
83 |
Execution timed out |
1014 ms |
60588 KB |
Time limit exceeded |
84 |
Execution timed out |
1046 ms |
60536 KB |
Time limit exceeded |
85 |
Execution timed out |
1022 ms |
60592 KB |
Time limit exceeded |
86 |
Execution timed out |
1030 ms |
60536 KB |
Time limit exceeded |
87 |
Execution timed out |
1008 ms |
60488 KB |
Time limit exceeded |
88 |
Execution timed out |
1038 ms |
60480 KB |
Time limit exceeded |
89 |
Execution timed out |
1006 ms |
60536 KB |
Time limit exceeded |
90 |
Execution timed out |
1062 ms |
48376 KB |
Time limit exceeded |
91 |
Execution timed out |
1091 ms |
60636 KB |
Time limit exceeded |
92 |
Execution timed out |
1097 ms |
60536 KB |
Time limit exceeded |
93 |
Execution timed out |
1070 ms |
60536 KB |
Time limit exceeded |
94 |
Execution timed out |
1040 ms |
60536 KB |
Time limit exceeded |
95 |
Execution timed out |
1060 ms |
60664 KB |
Time limit exceeded |
96 |
Execution timed out |
1012 ms |
60476 KB |
Time limit exceeded |
97 |
Execution timed out |
1045 ms |
60536 KB |
Time limit exceeded |
98 |
Execution timed out |
1064 ms |
60512 KB |
Time limit exceeded |
99 |
Execution timed out |
1014 ms |
60416 KB |
Time limit exceeded |
100 |
Execution timed out |
1008 ms |
60304 KB |
Time limit exceeded |