#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,m;
int a[2505][2505];
int main(){
ios::sync_with_stdio(false);
cin >> n >> m;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
char x;
cin >> x;
a[i][j] = (x == '1');
}
}
ll indx = 1000000;
for(int i=1; i<=n; i++){
ll las = 0;
for(int j=1; j<=m; j++){
if(a[i][j] == 0){
las = j;
continue;
}
if(a[i][j + 1] == 0){
indx = min(indx , j - las);
}
}
}
ll indy = 1000000;
for(int i=1; i<=m; i++){
ll las = 0;
for(int j=1; j<=n; j++){
if(a[j][i] == 0){
las = j;
continue;
}
if(a[j + 1][i] == 0){
indy = min(indy , j - las);
}
}
}
if(indx == indy && indx == 1000000){
cout << 0;
return 0;
}
cout << indx * indy << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
9 ms |
10360 KB |
Output is correct |
4 |
Correct |
10 ms |
10360 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
508 KB |
Output isn't correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
632 KB |
Output is correct |
18 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
19 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
22 |
Incorrect |
3 ms |
888 KB |
Output isn't correct |
23 |
Incorrect |
3 ms |
760 KB |
Output isn't correct |
24 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
25 |
Incorrect |
3 ms |
760 KB |
Output isn't correct |
26 |
Correct |
2 ms |
760 KB |
Output is correct |
27 |
Correct |
5 ms |
1912 KB |
Output is correct |
28 |
Incorrect |
6 ms |
2040 KB |
Output isn't correct |
29 |
Incorrect |
7 ms |
2552 KB |
Output isn't correct |
30 |
Incorrect |
8 ms |
2936 KB |
Output isn't correct |
31 |
Incorrect |
7 ms |
2424 KB |
Output isn't correct |
32 |
Incorrect |
7 ms |
2680 KB |
Output isn't correct |
33 |
Incorrect |
8 ms |
3064 KB |
Output isn't correct |
34 |
Incorrect |
5 ms |
2168 KB |
Output isn't correct |
35 |
Incorrect |
8 ms |
3064 KB |
Output isn't correct |
36 |
Correct |
9 ms |
3208 KB |
Output is correct |
37 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
38 |
Correct |
203 ms |
28772 KB |
Output is correct |
39 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
40 |
Incorrect |
26 ms |
7672 KB |
Output isn't correct |
41 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
42 |
Incorrect |
3 ms |
760 KB |
Output isn't correct |
43 |
Correct |
199 ms |
26984 KB |
Output is correct |
44 |
Incorrect |
9 ms |
3064 KB |
Output isn't correct |
45 |
Incorrect |
199 ms |
29944 KB |
Output isn't correct |
46 |
Correct |
198 ms |
26872 KB |
Output is correct |
47 |
Incorrect |
203 ms |
26872 KB |
Output isn't correct |
48 |
Incorrect |
203 ms |
28896 KB |
Output isn't correct |
49 |
Correct |
205 ms |
30456 KB |
Output is correct |
50 |
Incorrect |
197 ms |
26872 KB |
Output isn't correct |
51 |
Incorrect |
199 ms |
26828 KB |
Output isn't correct |
52 |
Incorrect |
198 ms |
30076 KB |
Output isn't correct |
53 |
Incorrect |
197 ms |
26872 KB |
Output isn't correct |
54 |
Incorrect |
195 ms |
28904 KB |
Output isn't correct |
55 |
Incorrect |
195 ms |
26848 KB |
Output isn't correct |
56 |
Correct |
217 ms |
30324 KB |
Output is correct |
57 |
Incorrect |
194 ms |
26844 KB |
Output isn't correct |
58 |
Incorrect |
192 ms |
26940 KB |
Output isn't correct |
59 |
Incorrect |
195 ms |
26884 KB |
Output isn't correct |
60 |
Correct |
196 ms |
26836 KB |
Output is correct |
61 |
Correct |
201 ms |
27008 KB |
Output is correct |
62 |
Correct |
218 ms |
27016 KB |
Output is correct |
63 |
Correct |
208 ms |
27000 KB |
Output is correct |
64 |
Correct |
195 ms |
26872 KB |
Output is correct |
65 |
Incorrect |
207 ms |
26764 KB |
Output isn't correct |
66 |
Incorrect |
201 ms |
30456 KB |
Output isn't correct |
67 |
Incorrect |
198 ms |
27000 KB |
Output isn't correct |
68 |
Incorrect |
198 ms |
26872 KB |
Output isn't correct |
69 |
Incorrect |
194 ms |
26936 KB |
Output isn't correct |
70 |
Incorrect |
122 ms |
23812 KB |
Output isn't correct |
71 |
Incorrect |
193 ms |
26772 KB |
Output isn't correct |
72 |
Incorrect |
195 ms |
30200 KB |
Output isn't correct |
73 |
Incorrect |
195 ms |
27072 KB |
Output isn't correct |
74 |
Incorrect |
195 ms |
26972 KB |
Output isn't correct |
75 |
Incorrect |
194 ms |
26844 KB |
Output isn't correct |
76 |
Incorrect |
196 ms |
29472 KB |
Output isn't correct |
77 |
Incorrect |
204 ms |
26728 KB |
Output isn't correct |
78 |
Incorrect |
197 ms |
29816 KB |
Output isn't correct |
79 |
Incorrect |
191 ms |
26488 KB |
Output isn't correct |
80 |
Incorrect |
191 ms |
26488 KB |
Output isn't correct |
81 |
Incorrect |
190 ms |
26684 KB |
Output isn't correct |
82 |
Incorrect |
194 ms |
26548 KB |
Output isn't correct |
83 |
Incorrect |
195 ms |
26488 KB |
Output isn't correct |
84 |
Incorrect |
193 ms |
26272 KB |
Output isn't correct |
85 |
Incorrect |
194 ms |
26232 KB |
Output isn't correct |
86 |
Incorrect |
202 ms |
26104 KB |
Output isn't correct |
87 |
Incorrect |
194 ms |
26104 KB |
Output isn't correct |
88 |
Incorrect |
194 ms |
26232 KB |
Output isn't correct |
89 |
Incorrect |
197 ms |
26372 KB |
Output isn't correct |
90 |
Incorrect |
124 ms |
23900 KB |
Output isn't correct |
91 |
Incorrect |
204 ms |
26204 KB |
Output isn't correct |
92 |
Incorrect |
219 ms |
26092 KB |
Output isn't correct |
93 |
Incorrect |
216 ms |
26000 KB |
Output isn't correct |
94 |
Incorrect |
196 ms |
26104 KB |
Output isn't correct |
95 |
Incorrect |
208 ms |
26196 KB |
Output isn't correct |
96 |
Incorrect |
196 ms |
25864 KB |
Output isn't correct |
97 |
Incorrect |
210 ms |
25848 KB |
Output isn't correct |
98 |
Incorrect |
194 ms |
25716 KB |
Output isn't correct |
99 |
Incorrect |
196 ms |
25720 KB |
Output isn't correct |
100 |
Incorrect |
204 ms |
25896 KB |
Output isn't correct |