#include <bits/stdc++.h>
using namespace std;
const int N = 2505, INF = 1e9 + 5;
int n, m;
bool a[N][N];
int w = INF, h = INF;
int main(){
cin >> n >> m;
char x;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> x;
a[i][j] = (x == '1');
}
}
int now = 0, np = INF;
for(int i = 0; i < n; i++){
now = 0;
for(int j = 0; j < m; j++){
if(!a[i][j]){
if(now) np = min(np, now);
now = 0;
}
else now++;
}
if(now) np = min(np, now);
}
w = np;
np = INF;
for(int i = 0; i < n; i++){
now = 0;
for(int j = 0; j < m; j++){
if(!a[j][i]){
if(now) np = min(np, now);
now = 0;
}
else now++;
}
if(now) np = min(np, now);
}
h = np;
cout << w * h << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
304 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
6356 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
6356 KB |
Output isn't correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 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 |
1 ms |
340 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
16 |
Correct |
1 ms |
304 KB |
Output is correct |
17 |
Correct |
1 ms |
468 KB |
Output is correct |
18 |
Incorrect |
1 ms |
444 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
436 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
26 |
Correct |
2 ms |
448 KB |
Output is correct |
27 |
Correct |
5 ms |
1108 KB |
Output is correct |
28 |
Incorrect |
8 ms |
1024 KB |
Output isn't correct |
29 |
Incorrect |
8 ms |
1364 KB |
Output isn't correct |
30 |
Incorrect |
12 ms |
1500 KB |
Output isn't correct |
31 |
Incorrect |
10 ms |
1212 KB |
Output isn't correct |
32 |
Incorrect |
10 ms |
1348 KB |
Output isn't correct |
33 |
Incorrect |
12 ms |
1608 KB |
Output isn't correct |
34 |
Incorrect |
6 ms |
1228 KB |
Output isn't correct |
35 |
Incorrect |
13 ms |
1492 KB |
Output isn't correct |
36 |
Correct |
13 ms |
1492 KB |
Output is correct |
37 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
38 |
Correct |
377 ms |
12524 KB |
Output is correct |
39 |
Incorrect |
0 ms |
304 KB |
Output isn't correct |
40 |
Incorrect |
47 ms |
3128 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
444 KB |
Output isn't correct |
43 |
Correct |
400 ms |
12484 KB |
Output is correct |
44 |
Incorrect |
12 ms |
1492 KB |
Output isn't correct |
45 |
Incorrect |
387 ms |
12504 KB |
Output isn't correct |
46 |
Correct |
391 ms |
12556 KB |
Output is correct |
47 |
Incorrect |
362 ms |
12492 KB |
Output isn't correct |
48 |
Incorrect |
388 ms |
12436 KB |
Output isn't correct |
49 |
Correct |
369 ms |
12512 KB |
Output is correct |
50 |
Incorrect |
373 ms |
12472 KB |
Output isn't correct |
51 |
Incorrect |
371 ms |
12588 KB |
Output isn't correct |
52 |
Incorrect |
377 ms |
12524 KB |
Output isn't correct |
53 |
Incorrect |
369 ms |
12476 KB |
Output isn't correct |
54 |
Incorrect |
377 ms |
12488 KB |
Output isn't correct |
55 |
Incorrect |
383 ms |
12496 KB |
Output isn't correct |
56 |
Correct |
371 ms |
12480 KB |
Output is correct |
57 |
Incorrect |
374 ms |
12520 KB |
Output isn't correct |
58 |
Incorrect |
361 ms |
12552 KB |
Output isn't correct |
59 |
Incorrect |
367 ms |
12460 KB |
Output isn't correct |
60 |
Correct |
369 ms |
12560 KB |
Output is correct |
61 |
Correct |
373 ms |
12460 KB |
Output is correct |
62 |
Correct |
369 ms |
12592 KB |
Output is correct |
63 |
Correct |
379 ms |
12492 KB |
Output is correct |
64 |
Correct |
369 ms |
12424 KB |
Output is correct |
65 |
Incorrect |
382 ms |
12492 KB |
Output isn't correct |
66 |
Incorrect |
362 ms |
12492 KB |
Output isn't correct |
67 |
Incorrect |
361 ms |
12620 KB |
Output isn't correct |
68 |
Incorrect |
376 ms |
12500 KB |
Output isn't correct |
69 |
Incorrect |
364 ms |
12516 KB |
Output isn't correct |
70 |
Incorrect |
231 ms |
9164 KB |
Output isn't correct |
71 |
Incorrect |
360 ms |
12408 KB |
Output isn't correct |
72 |
Incorrect |
370 ms |
12476 KB |
Output isn't correct |
73 |
Incorrect |
376 ms |
12616 KB |
Output isn't correct |
74 |
Incorrect |
378 ms |
12516 KB |
Output isn't correct |
75 |
Incorrect |
377 ms |
12488 KB |
Output isn't correct |
76 |
Incorrect |
378 ms |
12492 KB |
Output isn't correct |
77 |
Incorrect |
374 ms |
12516 KB |
Output isn't correct |
78 |
Incorrect |
379 ms |
12476 KB |
Output isn't correct |
79 |
Incorrect |
374 ms |
12432 KB |
Output isn't correct |
80 |
Incorrect |
369 ms |
12576 KB |
Output isn't correct |
81 |
Incorrect |
379 ms |
12500 KB |
Output isn't correct |
82 |
Incorrect |
386 ms |
12488 KB |
Output isn't correct |
83 |
Incorrect |
363 ms |
12488 KB |
Output isn't correct |
84 |
Incorrect |
365 ms |
12420 KB |
Output isn't correct |
85 |
Incorrect |
374 ms |
12584 KB |
Output isn't correct |
86 |
Incorrect |
383 ms |
12516 KB |
Output isn't correct |
87 |
Incorrect |
382 ms |
12524 KB |
Output isn't correct |
88 |
Incorrect |
370 ms |
12524 KB |
Output isn't correct |
89 |
Incorrect |
385 ms |
12612 KB |
Output isn't correct |
90 |
Incorrect |
232 ms |
9052 KB |
Output isn't correct |
91 |
Incorrect |
367 ms |
12628 KB |
Output isn't correct |
92 |
Incorrect |
384 ms |
12484 KB |
Output isn't correct |
93 |
Incorrect |
379 ms |
12624 KB |
Output isn't correct |
94 |
Incorrect |
373 ms |
12420 KB |
Output isn't correct |
95 |
Incorrect |
367 ms |
12572 KB |
Output isn't correct |
96 |
Incorrect |
368 ms |
12444 KB |
Output isn't correct |
97 |
Incorrect |
370 ms |
12492 KB |
Output isn't correct |
98 |
Incorrect |
364 ms |
12488 KB |
Output isn't correct |
99 |
Incorrect |
383 ms |
12580 KB |
Output isn't correct |
100 |
Incorrect |
376 ms |
12496 KB |
Output isn't correct |