#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 2504;
int chainw[maxn][maxn];
int maxw[maxn];
int chainh[maxn][maxn];
int maxh[maxn];
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
char x;
cin >> x;
if (x == '1') {
chainw[i][j] = chainw[i][j-1]+1;
chainh[i][j] = chainh[i-1][j]+1;
maxw[i] = j;
maxh[j] = i;
}
}
}
int maxpossiblew = maxn;
int maxpossibleh = maxn;
for (int i = 1; i <= n; i++) {
if (maxw[i] == 0) continue;
maxpossiblew = min(maxpossiblew, chainw[i][maxw[i]]);
}
for (int j = 1; j <= m; j++) {
if (maxh[j] == 0) continue;
maxpossibleh = min(maxpossibleh, chainh[maxh[j]][j]);
}
cout << maxpossibleh * maxpossiblew << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Correct |
9 ms |
20280 KB |
Output is correct |
4 |
Incorrect |
9 ms |
20316 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
16 |
Correct |
0 ms |
468 KB |
Output is correct |
17 |
Correct |
1 ms |
724 KB |
Output is correct |
18 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
26 |
Incorrect |
1 ms |
1108 KB |
Output isn't correct |
27 |
Incorrect |
4 ms |
3284 KB |
Output isn't correct |
28 |
Incorrect |
4 ms |
596 KB |
Output isn't correct |
29 |
Incorrect |
7 ms |
4180 KB |
Output isn't correct |
30 |
Incorrect |
9 ms |
3084 KB |
Output isn't correct |
31 |
Incorrect |
8 ms |
2204 KB |
Output isn't correct |
32 |
Incorrect |
7 ms |
3028 KB |
Output isn't correct |
33 |
Incorrect |
8 ms |
4052 KB |
Output isn't correct |
34 |
Incorrect |
3 ms |
724 KB |
Output isn't correct |
35 |
Incorrect |
11 ms |
872 KB |
Output isn't correct |
36 |
Incorrect |
9 ms |
5460 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
468 KB |
Output isn't correct |
38 |
Correct |
230 ms |
49228 KB |
Output is correct |
39 |
Incorrect |
0 ms |
468 KB |
Output isn't correct |
40 |
Incorrect |
31 ms |
13260 KB |
Output isn't correct |
41 |
Incorrect |
0 ms |
468 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
1108 KB |
Output isn't correct |
43 |
Correct |
220 ms |
45464 KB |
Output is correct |
44 |
Incorrect |
9 ms |
4920 KB |
Output isn't correct |
45 |
Incorrect |
229 ms |
46812 KB |
Output isn't correct |
46 |
Correct |
223 ms |
49284 KB |
Output is correct |
47 |
Incorrect |
221 ms |
46800 KB |
Output isn't correct |
48 |
Incorrect |
235 ms |
49292 KB |
Output isn't correct |
49 |
Incorrect |
220 ms |
49264 KB |
Output isn't correct |
50 |
Incorrect |
221 ms |
49192 KB |
Output isn't correct |
51 |
Incorrect |
252 ms |
49208 KB |
Output isn't correct |
52 |
Incorrect |
239 ms |
49252 KB |
Output isn't correct |
53 |
Incorrect |
230 ms |
48636 KB |
Output isn't correct |
54 |
Incorrect |
226 ms |
35912 KB |
Output isn't correct |
55 |
Incorrect |
218 ms |
34176 KB |
Output isn't correct |
56 |
Correct |
222 ms |
49308 KB |
Output is correct |
57 |
Incorrect |
254 ms |
29404 KB |
Output isn't correct |
58 |
Incorrect |
215 ms |
34380 KB |
Output isn't correct |
59 |
Incorrect |
219 ms |
31180 KB |
Output isn't correct |
60 |
Incorrect |
238 ms |
41012 KB |
Output isn't correct |
61 |
Incorrect |
220 ms |
49304 KB |
Output isn't correct |
62 |
Incorrect |
220 ms |
49228 KB |
Output isn't correct |
63 |
Incorrect |
223 ms |
49444 KB |
Output isn't correct |
64 |
Incorrect |
219 ms |
32164 KB |
Output isn't correct |
65 |
Incorrect |
238 ms |
48224 KB |
Output isn't correct |
66 |
Incorrect |
227 ms |
45072 KB |
Output isn't correct |
67 |
Incorrect |
222 ms |
49240 KB |
Output isn't correct |
68 |
Incorrect |
236 ms |
49268 KB |
Output isn't correct |
69 |
Incorrect |
247 ms |
28940 KB |
Output isn't correct |
70 |
Incorrect |
155 ms |
10212 KB |
Output isn't correct |
71 |
Incorrect |
216 ms |
21856 KB |
Output isn't correct |
72 |
Incorrect |
213 ms |
27392 KB |
Output isn't correct |
73 |
Incorrect |
232 ms |
27768 KB |
Output isn't correct |
74 |
Incorrect |
220 ms |
29448 KB |
Output isn't correct |
75 |
Incorrect |
217 ms |
30920 KB |
Output isn't correct |
76 |
Incorrect |
238 ms |
32476 KB |
Output isn't correct |
77 |
Incorrect |
213 ms |
32756 KB |
Output isn't correct |
78 |
Incorrect |
241 ms |
33088 KB |
Output isn't correct |
79 |
Incorrect |
212 ms |
5564 KB |
Output isn't correct |
80 |
Incorrect |
200 ms |
6888 KB |
Output isn't correct |
81 |
Incorrect |
203 ms |
7256 KB |
Output isn't correct |
82 |
Incorrect |
221 ms |
35568 KB |
Output isn't correct |
83 |
Incorrect |
219 ms |
35840 KB |
Output isn't correct |
84 |
Incorrect |
204 ms |
912 KB |
Output isn't correct |
85 |
Incorrect |
216 ms |
34568 KB |
Output isn't correct |
86 |
Incorrect |
255 ms |
48148 KB |
Output isn't correct |
87 |
Incorrect |
214 ms |
33528 KB |
Output isn't correct |
88 |
Incorrect |
236 ms |
34428 KB |
Output isn't correct |
89 |
Incorrect |
229 ms |
43240 KB |
Output isn't correct |
90 |
Incorrect |
144 ms |
24452 KB |
Output isn't correct |
91 |
Incorrect |
222 ms |
38420 KB |
Output isn't correct |
92 |
Incorrect |
229 ms |
40116 KB |
Output isn't correct |
93 |
Incorrect |
220 ms |
47292 KB |
Output isn't correct |
94 |
Incorrect |
221 ms |
41856 KB |
Output isn't correct |
95 |
Incorrect |
238 ms |
35948 KB |
Output isn't correct |
96 |
Incorrect |
225 ms |
35420 KB |
Output isn't correct |
97 |
Incorrect |
238 ms |
48024 KB |
Output isn't correct |
98 |
Incorrect |
233 ms |
35268 KB |
Output isn't correct |
99 |
Incorrect |
220 ms |
41548 KB |
Output isn't correct |
100 |
Incorrect |
221 ms |
46776 KB |
Output isn't correct |