Submission #343261

# Submission time Handle Problem Language Result Execution time Memory
343261 2021-01-03T15:21:45 Z Pety Bomb (IZhO17_bomb) C++14
24 / 100
490 ms 61732 KB
#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]);
    }
  cout << w * h << "\n";
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 21 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 640 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 512 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 1 ms 748 KB Output isn't correct
19 Incorrect 1 ms 1004 KB Output isn't correct
20 Incorrect 1 ms 1004 KB Output isn't correct
21 Incorrect 1 ms 620 KB Output isn't correct
22 Incorrect 1 ms 876 KB Output isn't correct
23 Incorrect 2 ms 1004 KB Output isn't correct
24 Incorrect 1 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 1516 KB Output isn't correct
29 Incorrect 15 ms 5356 KB Output isn't correct
30 Incorrect 19 ms 4332 KB Output isn't correct
31 Incorrect 12 ms 3180 KB Output isn't correct
32 Incorrect 13 ms 4204 KB Output isn't correct
33 Incorrect 16 ms 5484 KB Output isn't correct
34 Incorrect 7 ms 1772 KB Output isn't correct
35 Incorrect 14 ms 2156 KB Output isn't correct
36 Correct 17 ms 6892 KB Output is correct
37 Incorrect 1 ms 492 KB Output isn't correct
38 Correct 431 ms 61732 KB Output is correct
39 Incorrect 1 ms 492 KB Output isn't correct
40 Incorrect 59 ms 16236 KB Output isn't correct
41 Incorrect 1 ms 492 KB Output isn't correct
42 Incorrect 2 ms 1388 KB Output isn't correct
43 Correct 422 ms 57708 KB Output is correct
44 Incorrect 17 ms 6252 KB Output isn't correct
45 Incorrect 429 ms 59088 KB Output isn't correct
46 Correct 445 ms 61548 KB Output is correct
47 Incorrect 426 ms 59116 KB Output isn't correct
48 Incorrect 427 ms 61676 KB Output isn't correct
49 Correct 438 ms 61584 KB Output is correct
50 Incorrect 427 ms 61548 KB Output isn't correct
51 Incorrect 422 ms 61548 KB Output isn't correct
52 Incorrect 438 ms 61548 KB Output isn't correct
53 Incorrect 422 ms 60908 KB Output isn't correct
54 Incorrect 414 ms 48364 KB Output isn't correct
55 Incorrect 416 ms 46572 KB Output isn't correct
56 Correct 442 ms 61676 KB Output is correct
57 Incorrect 410 ms 41708 KB Output isn't correct
58 Incorrect 416 ms 46716 KB Output isn't correct
59 Incorrect 415 ms 43628 KB Output isn't correct
60 Correct 419 ms 53356 KB Output is correct
61 Correct 431 ms 61548 KB Output is correct
62 Correct 427 ms 61548 KB Output is correct
63 Correct 428 ms 61676 KB Output is correct
64 Correct 412 ms 44524 KB Output is correct
65 Incorrect 421 ms 60396 KB Output isn't correct
66 Incorrect 424 ms 57704 KB Output isn't correct
67 Incorrect 438 ms 61548 KB Output isn't correct
68 Incorrect 424 ms 61676 KB Output isn't correct
69 Incorrect 425 ms 41324 KB Output isn't correct
70 Incorrect 257 ms 19180 KB Output isn't correct
71 Incorrect 402 ms 34284 KB Output isn't correct
72 Incorrect 405 ms 39660 KB Output isn't correct
73 Incorrect 406 ms 40172 KB Output isn't correct
74 Incorrect 405 ms 41708 KB Output isn't correct
75 Incorrect 411 ms 43628 KB Output isn't correct
76 Incorrect 416 ms 44804 KB Output isn't correct
77 Incorrect 411 ms 45164 KB Output isn't correct
78 Incorrect 408 ms 45420 KB Output isn't correct
79 Incorrect 392 ms 17984 KB Output isn't correct
80 Incorrect 393 ms 19308 KB Output isn't correct
81 Incorrect 449 ms 19564 KB Output isn't correct
82 Incorrect 417 ms 47856 KB Output isn't correct
83 Incorrect 411 ms 47980 KB Output isn't correct
84 Incorrect 391 ms 13292 KB Output isn't correct
85 Incorrect 417 ms 46956 KB Output isn't correct
86 Incorrect 461 ms 60396 KB Output isn't correct
87 Incorrect 411 ms 45932 KB Output isn't correct
88 Incorrect 478 ms 46700 KB Output isn't correct
89 Incorrect 423 ms 55548 KB Output isn't correct
90 Incorrect 348 ms 33620 KB Output isn't correct
91 Incorrect 490 ms 50796 KB Output isn't correct
92 Incorrect 424 ms 52344 KB Output isn't correct
93 Incorrect 435 ms 59504 KB Output isn't correct
94 Incorrect 433 ms 54284 KB Output isn't correct
95 Incorrect 416 ms 48108 KB Output isn't correct
96 Incorrect 483 ms 47792 KB Output isn't correct
97 Incorrect 431 ms 60420 KB Output isn't correct
98 Incorrect 462 ms 47548 KB Output isn't correct
99 Incorrect 437 ms 53892 KB Output isn't correct
100 Incorrect 427 ms 59116 KB Output isn't correct