#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int n, m, lebar, tinggi, satu;
bool flag=true;
ll ans;
string s[25002];
cin>>n>>m;
for(int i=0; i<n; i++){
cin>>s[i];
}
lebar=m;
tinggi=n;
satu=0;
int j;
for(int i=0; i<n; i++){
j=0;
while(j<m){
if(s[i][j] == '1'){
satu++;
flag=false;
}
else{
if(satu>0) lebar=min(lebar, satu);
satu=0;
}
j++;
}
if(satu>0) lebar=min(lebar, satu);
}
satu=0;
for(int i=0; i<m; i++){
j=0;
while(j<n){
if(s[j][i] == '1') satu++;
else{
if(satu>0) tinggi=min(tinggi, satu);
satu=0;
}
j++;
}
if(satu>0) tinggi=min(tinggi, satu);
}
ans=(ll)tinggi*lebar;
if(flag) ans=0;
cout<<ans<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
1 ms |
980 KB |
Output is correct |
4 |
Correct |
1 ms |
980 KB |
Output is correct |
5 |
Correct |
1 ms |
980 KB |
Output is correct |
6 |
Correct |
1 ms |
980 KB |
Output is correct |
7 |
Correct |
1 ms |
980 KB |
Output is correct |
8 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
13 |
Correct |
1 ms |
980 KB |
Output is correct |
14 |
Correct |
1 ms |
980 KB |
Output is correct |
15 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
16 |
Correct |
1 ms |
980 KB |
Output is correct |
17 |
Correct |
1 ms |
980 KB |
Output is correct |
18 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
26 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
27 |
Incorrect |
2 ms |
1108 KB |
Output isn't correct |
28 |
Incorrect |
3 ms |
1108 KB |
Output isn't correct |
29 |
Incorrect |
3 ms |
1236 KB |
Output isn't correct |
30 |
Incorrect |
4 ms |
1236 KB |
Output isn't correct |
31 |
Incorrect |
3 ms |
1236 KB |
Output isn't correct |
32 |
Incorrect |
3 ms |
1236 KB |
Output isn't correct |
33 |
Incorrect |
4 ms |
1236 KB |
Output isn't correct |
34 |
Incorrect |
2 ms |
1108 KB |
Output isn't correct |
35 |
Incorrect |
4 ms |
1236 KB |
Output isn't correct |
36 |
Incorrect |
4 ms |
1236 KB |
Output isn't correct |
37 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
38 |
Correct |
127 ms |
10372 KB |
Output is correct |
39 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
40 |
Incorrect |
17 ms |
1876 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
43 |
Correct |
139 ms |
10496 KB |
Output is correct |
44 |
Incorrect |
5 ms |
1232 KB |
Output isn't correct |
45 |
Incorrect |
135 ms |
10388 KB |
Output isn't correct |
46 |
Correct |
128 ms |
10464 KB |
Output is correct |
47 |
Incorrect |
141 ms |
10532 KB |
Output isn't correct |
48 |
Incorrect |
132 ms |
10524 KB |
Output isn't correct |
49 |
Incorrect |
122 ms |
10428 KB |
Output isn't correct |
50 |
Incorrect |
129 ms |
10412 KB |
Output isn't correct |
51 |
Incorrect |
152 ms |
10496 KB |
Output isn't correct |
52 |
Incorrect |
133 ms |
10384 KB |
Output isn't correct |
53 |
Incorrect |
130 ms |
10496 KB |
Output isn't correct |
54 |
Incorrect |
133 ms |
10492 KB |
Output isn't correct |
55 |
Incorrect |
120 ms |
10444 KB |
Output isn't correct |
56 |
Correct |
132 ms |
10424 KB |
Output is correct |
57 |
Incorrect |
131 ms |
10576 KB |
Output isn't correct |
58 |
Incorrect |
147 ms |
10488 KB |
Output isn't correct |
59 |
Incorrect |
152 ms |
10488 KB |
Output isn't correct |
60 |
Incorrect |
141 ms |
10492 KB |
Output isn't correct |
61 |
Correct |
117 ms |
10444 KB |
Output is correct |
62 |
Incorrect |
121 ms |
10536 KB |
Output isn't correct |
63 |
Incorrect |
137 ms |
10452 KB |
Output isn't correct |
64 |
Incorrect |
126 ms |
10444 KB |
Output isn't correct |
65 |
Incorrect |
127 ms |
10492 KB |
Output isn't correct |
66 |
Incorrect |
132 ms |
10496 KB |
Output isn't correct |
67 |
Incorrect |
138 ms |
10396 KB |
Output isn't correct |
68 |
Incorrect |
128 ms |
10428 KB |
Output isn't correct |
69 |
Incorrect |
125 ms |
10440 KB |
Output isn't correct |
70 |
Incorrect |
69 ms |
8496 KB |
Output isn't correct |
71 |
Incorrect |
123 ms |
10400 KB |
Output isn't correct |
72 |
Incorrect |
122 ms |
10488 KB |
Output isn't correct |
73 |
Incorrect |
140 ms |
10376 KB |
Output isn't correct |
74 |
Incorrect |
123 ms |
10488 KB |
Output isn't correct |
75 |
Incorrect |
129 ms |
10388 KB |
Output isn't correct |
76 |
Incorrect |
130 ms |
10444 KB |
Output isn't correct |
77 |
Incorrect |
130 ms |
10452 KB |
Output isn't correct |
78 |
Incorrect |
134 ms |
10400 KB |
Output isn't correct |
79 |
Incorrect |
123 ms |
10492 KB |
Output isn't correct |
80 |
Incorrect |
130 ms |
10424 KB |
Output isn't correct |
81 |
Incorrect |
129 ms |
10536 KB |
Output isn't correct |
82 |
Incorrect |
137 ms |
10492 KB |
Output isn't correct |
83 |
Incorrect |
139 ms |
10428 KB |
Output isn't correct |
84 |
Incorrect |
127 ms |
10488 KB |
Output isn't correct |
85 |
Incorrect |
129 ms |
10448 KB |
Output isn't correct |
86 |
Incorrect |
133 ms |
10376 KB |
Output isn't correct |
87 |
Incorrect |
153 ms |
10424 KB |
Output isn't correct |
88 |
Incorrect |
119 ms |
10448 KB |
Output isn't correct |
89 |
Incorrect |
130 ms |
10444 KB |
Output isn't correct |
90 |
Incorrect |
96 ms |
8584 KB |
Output isn't correct |
91 |
Incorrect |
143 ms |
10604 KB |
Output isn't correct |
92 |
Incorrect |
128 ms |
10420 KB |
Output isn't correct |
93 |
Incorrect |
134 ms |
10480 KB |
Output isn't correct |
94 |
Incorrect |
132 ms |
10428 KB |
Output isn't correct |
95 |
Incorrect |
132 ms |
10488 KB |
Output isn't correct |
96 |
Incorrect |
161 ms |
10496 KB |
Output isn't correct |
97 |
Incorrect |
132 ms |
10380 KB |
Output isn't correct |
98 |
Incorrect |
131 ms |
10452 KB |
Output isn't correct |
99 |
Incorrect |
136 ms |
10372 KB |
Output isn't correct |
100 |
Incorrect |
136 ms |
10496 KB |
Output isn't correct |