#include <bits/stdc++.h>
using namespace std;
int n, m, w, h, dp[2502][2502], dp2[2502][2502];
char v[2502][2502];
int main()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
cin >> v[i][j];
if (v[i][j] == '1') {
dp[i][j] = dp[i][j - 1] + 1;
dp2[i][j] = dp2[i - 1][j] + 1;
}
}
int w = 1e9, h = 1e9;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
if ((j == m && v[i][j] == '1') || (v[i][j] == '1' && v[i][j + 1] == '0'))
w = min(w, dp[i][j]);
if ((i == n && v[i][j] == '1') || (v[i][j] == '1' && v[i + 1][j] == '0'))
h = min(h, dp2[i][j]);
}
if (h == 1e9)
cout << "0\n";
cout << w * h << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
16 ms |
26476 KB |
Output is correct |
4 |
Correct |
16 ms |
26476 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 |
364 KB |
Output is correct |
8 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
13 |
Correct |
1 ms |
492 KB |
Output is correct |
14 |
Correct |
1 ms |
492 KB |
Output is correct |
15 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
16 |
Correct |
1 ms |
492 KB |
Output is correct |
17 |
Correct |
1 ms |
1004 KB |
Output is correct |
18 |
Incorrect |
2 ms |
748 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
1004 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
1004 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
620 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
748 KB |
Output isn't correct |
23 |
Incorrect |
2 ms |
1004 KB |
Output isn't correct |
24 |
Incorrect |
2 ms |
1004 KB |
Output isn't correct |
25 |
Incorrect |
2 ms |
1388 KB |
Output isn't correct |
26 |
Correct |
2 ms |
1516 KB |
Output is correct |
27 |
Correct |
8 ms |
4076 KB |
Output is correct |
28 |
Incorrect |
8 ms |
1388 KB |
Output isn't correct |
29 |
Incorrect |
11 ms |
5228 KB |
Output isn't correct |
30 |
Incorrect |
14 ms |
4204 KB |
Output isn't correct |
31 |
Incorrect |
12 ms |
3052 KB |
Output isn't correct |
32 |
Incorrect |
12 ms |
4076 KB |
Output isn't correct |
33 |
Incorrect |
17 ms |
5228 KB |
Output isn't correct |
34 |
Incorrect |
6 ms |
1772 KB |
Output isn't correct |
35 |
Incorrect |
14 ms |
1900 KB |
Output isn't correct |
36 |
Correct |
17 ms |
6636 KB |
Output is correct |
37 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
38 |
Correct |
426 ms |
55532 KB |
Output is correct |
39 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
40 |
Incorrect |
59 ms |
15596 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
42 |
Incorrect |
2 ms |
1536 KB |
Output isn't correct |
43 |
Correct |
422 ms |
51692 KB |
Output is correct |
44 |
Incorrect |
17 ms |
6124 KB |
Output isn't correct |
45 |
Incorrect |
414 ms |
52960 KB |
Output isn't correct |
46 |
Correct |
427 ms |
55404 KB |
Output is correct |
47 |
Incorrect |
416 ms |
52972 KB |
Output isn't correct |
48 |
Incorrect |
415 ms |
55532 KB |
Output isn't correct |
49 |
Correct |
425 ms |
55552 KB |
Output is correct |
50 |
Incorrect |
436 ms |
55788 KB |
Output isn't correct |
51 |
Incorrect |
418 ms |
56044 KB |
Output isn't correct |
52 |
Incorrect |
420 ms |
56008 KB |
Output isn't correct |
53 |
Incorrect |
417 ms |
55404 KB |
Output isn't correct |
54 |
Incorrect |
404 ms |
42860 KB |
Output isn't correct |
55 |
Incorrect |
401 ms |
41068 KB |
Output isn't correct |
56 |
Correct |
430 ms |
56172 KB |
Output is correct |
57 |
Incorrect |
415 ms |
36076 KB |
Output isn't correct |
58 |
Incorrect |
404 ms |
41196 KB |
Output isn't correct |
59 |
Incorrect |
406 ms |
38100 KB |
Output isn't correct |
60 |
Correct |
414 ms |
47852 KB |
Output is correct |
61 |
Correct |
420 ms |
56044 KB |
Output is correct |
62 |
Correct |
428 ms |
56172 KB |
Output is correct |
63 |
Correct |
421 ms |
56044 KB |
Output is correct |
64 |
Correct |
407 ms |
38892 KB |
Output is correct |
65 |
Incorrect |
412 ms |
55020 KB |
Output isn't correct |
66 |
Incorrect |
419 ms |
52044 KB |
Output isn't correct |
67 |
Incorrect |
418 ms |
56044 KB |
Output isn't correct |
68 |
Incorrect |
418 ms |
56044 KB |
Output isn't correct |
69 |
Incorrect |
406 ms |
35884 KB |
Output isn't correct |
70 |
Incorrect |
250 ms |
15852 KB |
Output isn't correct |
71 |
Incorrect |
394 ms |
28780 KB |
Output isn't correct |
72 |
Incorrect |
400 ms |
34284 KB |
Output isn't correct |
73 |
Incorrect |
401 ms |
34900 KB |
Output isn't correct |
74 |
Incorrect |
400 ms |
36360 KB |
Output isn't correct |
75 |
Incorrect |
404 ms |
37868 KB |
Output isn't correct |
76 |
Incorrect |
406 ms |
39276 KB |
Output isn't correct |
77 |
Incorrect |
411 ms |
39708 KB |
Output isn't correct |
78 |
Incorrect |
399 ms |
39916 KB |
Output isn't correct |
79 |
Incorrect |
389 ms |
12652 KB |
Output isn't correct |
80 |
Incorrect |
381 ms |
13804 KB |
Output isn't correct |
81 |
Incorrect |
383 ms |
14140 KB |
Output isn't correct |
82 |
Incorrect |
405 ms |
42348 KB |
Output isn't correct |
83 |
Incorrect |
404 ms |
42540 KB |
Output isn't correct |
84 |
Incorrect |
377 ms |
7660 KB |
Output isn't correct |
85 |
Incorrect |
411 ms |
41480 KB |
Output isn't correct |
86 |
Incorrect |
418 ms |
54764 KB |
Output isn't correct |
87 |
Incorrect |
400 ms |
40300 KB |
Output isn't correct |
88 |
Incorrect |
414 ms |
40968 KB |
Output isn't correct |
89 |
Incorrect |
414 ms |
49900 KB |
Output isn't correct |
90 |
Incorrect |
266 ms |
29676 KB |
Output isn't correct |
91 |
Incorrect |
407 ms |
44780 KB |
Output isn't correct |
92 |
Incorrect |
412 ms |
46384 KB |
Output isn't correct |
93 |
Incorrect |
438 ms |
53552 KB |
Output isn't correct |
94 |
Incorrect |
408 ms |
48108 KB |
Output isn't correct |
95 |
Incorrect |
403 ms |
42220 KB |
Output isn't correct |
96 |
Incorrect |
421 ms |
41836 KB |
Output isn't correct |
97 |
Incorrect |
416 ms |
54380 KB |
Output isn't correct |
98 |
Incorrect |
406 ms |
41836 KB |
Output isn't correct |
99 |
Incorrect |
418 ms |
47852 KB |
Output isn't correct |
100 |
Incorrect |
416 ms |
53228 KB |
Output isn't correct |