#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;
char a[2501][2501];
int main(){
//ios_base::sync_with_stdio(NULL);
// cin.tie(NULL);
// cout.tie(NULL);
int n,m;
cin >> n >>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin >> a[i][j];
}
}
int l,r,width=m,length=n;
for(int i=1;i<=n;i++){
l=-1,r=-1;
for(int j=1;j<=m;j++){
if(a[i][j]=='0'){
if(l!=-1){
width=min(width,r-l+1);
}
l=-1;
}
else{
if(l==-1){
l=j;
}
r=j;
}
}
if(l!=-1) width=min(width,r-l+1);
}
for(int i=1;i<=m;i++){
l=-1,r=-1;
for(int j=1;j<=n;j++){
if(a[j][i]=='0'){
if(l!=-1){
length=min(length,r-l+1);
}
l=-1;
}
else{
if(l==-1){
l=j;
}
r=j;
}
}
if(l!=-1) length=min(length,r-l+1);
}
cout << width*length;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
4 ms |
6380 KB |
Output is correct |
4 |
Correct |
4 ms |
6380 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
492 KB |
Output is correct |
18 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
620 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
620 KB |
Output isn't correct |
26 |
Correct |
1 ms |
620 KB |
Output is correct |
27 |
Correct |
6 ms |
1004 KB |
Output is correct |
28 |
Incorrect |
8 ms |
1004 KB |
Output isn't correct |
29 |
Incorrect |
9 ms |
1260 KB |
Output isn't correct |
30 |
Incorrect |
12 ms |
1388 KB |
Output isn't correct |
31 |
Incorrect |
10 ms |
1132 KB |
Output isn't correct |
32 |
Incorrect |
11 ms |
1260 KB |
Output isn't correct |
33 |
Incorrect |
15 ms |
1516 KB |
Output isn't correct |
34 |
Incorrect |
7 ms |
1132 KB |
Output isn't correct |
35 |
Incorrect |
13 ms |
1388 KB |
Output isn't correct |
36 |
Correct |
13 ms |
1388 KB |
Output is correct |
37 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
38 |
Correct |
404 ms |
6764 KB |
Output is correct |
39 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
40 |
Incorrect |
48 ms |
2796 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
42 |
Incorrect |
2 ms |
620 KB |
Output isn't correct |
43 |
Correct |
407 ms |
6764 KB |
Output is correct |
44 |
Incorrect |
14 ms |
1644 KB |
Output isn't correct |
45 |
Incorrect |
406 ms |
6656 KB |
Output isn't correct |
46 |
Correct |
409 ms |
6764 KB |
Output is correct |
47 |
Incorrect |
405 ms |
6764 KB |
Output isn't correct |
48 |
Incorrect |
407 ms |
6764 KB |
Output isn't correct |
49 |
Correct |
404 ms |
6636 KB |
Output is correct |
50 |
Incorrect |
403 ms |
6636 KB |
Output isn't correct |
51 |
Incorrect |
413 ms |
6764 KB |
Output isn't correct |
52 |
Incorrect |
410 ms |
6764 KB |
Output isn't correct |
53 |
Incorrect |
405 ms |
6892 KB |
Output isn't correct |
54 |
Incorrect |
403 ms |
6764 KB |
Output isn't correct |
55 |
Incorrect |
406 ms |
6636 KB |
Output isn't correct |
56 |
Correct |
403 ms |
6764 KB |
Output is correct |
57 |
Incorrect |
399 ms |
6636 KB |
Output isn't correct |
58 |
Incorrect |
402 ms |
6764 KB |
Output isn't correct |
59 |
Incorrect |
408 ms |
6636 KB |
Output isn't correct |
60 |
Correct |
402 ms |
6892 KB |
Output is correct |
61 |
Correct |
405 ms |
6636 KB |
Output is correct |
62 |
Correct |
406 ms |
6636 KB |
Output is correct |
63 |
Correct |
404 ms |
6636 KB |
Output is correct |
64 |
Correct |
401 ms |
6764 KB |
Output is correct |
65 |
Incorrect |
401 ms |
6764 KB |
Output isn't correct |
66 |
Incorrect |
406 ms |
6636 KB |
Output isn't correct |
67 |
Incorrect |
401 ms |
6764 KB |
Output isn't correct |
68 |
Incorrect |
407 ms |
6652 KB |
Output isn't correct |
69 |
Incorrect |
407 ms |
6764 KB |
Output isn't correct |
70 |
Incorrect |
241 ms |
5612 KB |
Output isn't correct |
71 |
Incorrect |
402 ms |
6636 KB |
Output isn't correct |
72 |
Incorrect |
406 ms |
6636 KB |
Output isn't correct |
73 |
Incorrect |
406 ms |
6892 KB |
Output isn't correct |
74 |
Incorrect |
408 ms |
6636 KB |
Output isn't correct |
75 |
Incorrect |
407 ms |
6636 KB |
Output isn't correct |
76 |
Incorrect |
401 ms |
6764 KB |
Output isn't correct |
77 |
Incorrect |
405 ms |
6636 KB |
Output isn't correct |
78 |
Incorrect |
404 ms |
6764 KB |
Output isn't correct |
79 |
Incorrect |
401 ms |
6764 KB |
Output isn't correct |
80 |
Incorrect |
401 ms |
6892 KB |
Output isn't correct |
81 |
Incorrect |
398 ms |
6636 KB |
Output isn't correct |
82 |
Incorrect |
400 ms |
6636 KB |
Output isn't correct |
83 |
Incorrect |
407 ms |
6764 KB |
Output isn't correct |
84 |
Incorrect |
401 ms |
6764 KB |
Output isn't correct |
85 |
Incorrect |
404 ms |
6636 KB |
Output isn't correct |
86 |
Incorrect |
404 ms |
6636 KB |
Output isn't correct |
87 |
Incorrect |
407 ms |
6764 KB |
Output isn't correct |
88 |
Incorrect |
401 ms |
6764 KB |
Output isn't correct |
89 |
Incorrect |
410 ms |
6720 KB |
Output isn't correct |
90 |
Incorrect |
241 ms |
5660 KB |
Output isn't correct |
91 |
Incorrect |
401 ms |
6636 KB |
Output isn't correct |
92 |
Incorrect |
402 ms |
6636 KB |
Output isn't correct |
93 |
Incorrect |
405 ms |
6636 KB |
Output isn't correct |
94 |
Incorrect |
403 ms |
6764 KB |
Output isn't correct |
95 |
Incorrect |
417 ms |
6732 KB |
Output isn't correct |
96 |
Incorrect |
401 ms |
6636 KB |
Output isn't correct |
97 |
Incorrect |
402 ms |
6764 KB |
Output isn't correct |
98 |
Incorrect |
403 ms |
6764 KB |
Output isn't correct |
99 |
Incorrect |
402 ms |
6636 KB |
Output isn't correct |
100 |
Incorrect |
424 ms |
6636 KB |
Output isn't correct |