#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int n, m;
char g[2505][2505];
char a[2505][2505];
char v[2505][2505];
void cpy(){
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
a[i][j] = g[i][j];
v[i][j] = 0;
}
}
}
bool val(int x, int y, int h, int w){
for(int i=x; i<=min(x+h-1, n); i++){
for(int j=y; j<=min(y+w-1, m); j++){
if(a[i][j] == '0') return false;
}
}
return true;
}
void fil(int x, int y, int h, int w){
for(int i=x; i<=min(x+h-1, n); i++){
for(int j=y; j<=min(y+w-1, m); j++){
a[i][j] = '0';
}
}
}
bool chk(int h, int w){
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(a[i][j] == '1'){
v[i][j] = val(i, j, h, w);
}
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(v[i][j]){
fil(i, j, h, w);
}
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(a[i][j] == '1') return false;
}
}
return true;
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n>>m;
if(n > 20 || m > 20){
cout<<1<<endl;
return 0;
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
cin>>g[i][j];
}
}
int mx = 1;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
cpy();
bool ok = chk(i, j);
if(ok) mx = max(mx, i*j);
}
}
cout<<mx<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
468 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
468 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
468 KB |
Output is correct |
16 |
Incorrect |
5 ms |
484 KB |
Output isn't correct |
17 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
26 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
27 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
28 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
29 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
30 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
260 KB |
Output isn't correct |
33 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
34 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
35 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
36 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
37 |
Correct |
2 ms |
468 KB |
Output is correct |
38 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
39 |
Correct |
4 ms |
480 KB |
Output is correct |
40 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
41 |
Correct |
3 ms |
468 KB |
Output is correct |
42 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
43 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
44 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
45 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
46 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
47 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
48 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
49 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
50 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
51 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
52 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
53 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
54 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
55 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
56 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
57 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
58 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
59 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
60 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
61 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
62 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
63 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
64 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
65 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
66 |
Incorrect |
0 ms |
216 KB |
Output isn't correct |
67 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
68 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
69 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
70 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
71 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
72 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
73 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
74 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
75 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
76 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
77 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
78 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
79 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
80 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
81 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
82 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
83 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
84 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
85 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
86 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
87 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
88 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
89 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
90 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
91 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
92 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
93 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
94 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
95 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
96 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
97 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
98 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
99 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
100 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |