Submission #422187

# Submission time Handle Problem Language Result Execution time Memory
422187 2021-06-09T20:32:45 Z antimirage Bomb (IZhO17_bomb) C++14
24 / 100
427 ms 31120 KB
#include <iostream>
#include <assert.h>

using namespace std;

const int N = 2505;

int n, m, a[N][N], w = N, h = N;

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        scanf("\n");
        for (int j = 1; j <= m; j++) {
            char ch;
            scanf("%c", &ch);
            a[i][j] = ch - 48;
        }
    }
    for (int i = 1; i <= n; i++) {
        int last = 0;
        for (int j = 1; j <= m + 1; j++) {
            if (a[i][j] == 0) {
                if (last != j - 1)
                    w = min(w, j - last - 1);
                last = j;
            }
        }
    }
    for (int j = 1; j <= m; j++) {
        int last = 0;
        for (int i = 1; i <= n + 1; i++) {
            if (a[i][j] == 0) {
                if (last != i - 1)
                    h = min(h, i - last - 1);
                last = i;
            }
        }
    }
    if (w == N) 
    assert(0);
    cout << w * h << endl;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("\n");
      |         ~~~~~^~~~~~
bomb.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |             scanf("%c", &ch);
      |             ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 6 ms 10292 KB Output is correct
4 Correct 6 ms 10316 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Incorrect 1 ms 332 KB Output isn't correct
10 Incorrect 1 ms 332 KB Output isn't correct
11 Incorrect 1 ms 332 KB Output isn't correct
12 Incorrect 1 ms 332 KB Output isn't correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Incorrect 1 ms 332 KB Output isn't correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 588 KB Output is correct
18 Incorrect 1 ms 588 KB Output isn't correct
19 Incorrect 1 ms 716 KB Output isn't correct
20 Incorrect 1 ms 716 KB Output isn't correct
21 Incorrect 1 ms 460 KB Output isn't correct
22 Incorrect 1 ms 588 KB Output isn't correct
23 Incorrect 1 ms 716 KB Output isn't correct
24 Incorrect 1 ms 588 KB Output isn't correct
25 Incorrect 2 ms 668 KB Output isn't correct
26 Correct 1 ms 696 KB Output is correct
27 Correct 5 ms 1868 KB Output is correct
28 Incorrect 8 ms 1996 KB Output isn't correct
29 Incorrect 8 ms 2380 KB Output isn't correct
30 Incorrect 13 ms 2944 KB Output isn't correct
31 Incorrect 10 ms 2372 KB Output isn't correct
32 Incorrect 10 ms 2636 KB Output isn't correct
33 Incorrect 13 ms 3020 KB Output isn't correct
34 Incorrect 6 ms 2140 KB Output isn't correct
35 Incorrect 13 ms 3040 KB Output isn't correct
36 Correct 13 ms 3020 KB Output is correct
37 Incorrect 1 ms 332 KB Output isn't correct
38 Correct 399 ms 30872 KB Output is correct
39 Incorrect 1 ms 332 KB Output isn't correct
40 Incorrect 45 ms 7484 KB Output isn't correct
41 Incorrect 1 ms 296 KB Output isn't correct
42 Incorrect 1 ms 716 KB Output isn't correct
43 Correct 427 ms 30880 KB Output is correct
44 Incorrect 13 ms 3020 KB Output isn't correct
45 Incorrect 405 ms 31008 KB Output isn't correct
46 Correct 412 ms 30912 KB Output is correct
47 Incorrect 391 ms 30808 KB Output isn't correct
48 Incorrect 391 ms 30828 KB Output isn't correct
49 Correct 390 ms 30908 KB Output is correct
50 Incorrect 386 ms 30828 KB Output isn't correct
51 Incorrect 391 ms 30872 KB Output isn't correct
52 Incorrect 387 ms 30984 KB Output isn't correct
53 Incorrect 392 ms 30832 KB Output isn't correct
54 Incorrect 388 ms 30916 KB Output isn't correct
55 Incorrect 389 ms 31044 KB Output isn't correct
56 Correct 387 ms 30904 KB Output is correct
57 Incorrect 386 ms 30972 KB Output isn't correct
58 Incorrect 386 ms 30840 KB Output isn't correct
59 Incorrect 390 ms 30880 KB Output isn't correct
60 Correct 385 ms 30880 KB Output is correct
61 Correct 372 ms 30836 KB Output is correct
62 Correct 386 ms 30912 KB Output is correct
63 Correct 384 ms 30936 KB Output is correct
64 Correct 421 ms 30884 KB Output is correct
65 Incorrect 424 ms 30816 KB Output isn't correct
66 Incorrect 386 ms 30916 KB Output isn't correct
67 Incorrect 391 ms 31008 KB Output isn't correct
68 Incorrect 391 ms 30808 KB Output isn't correct
69 Incorrect 420 ms 30912 KB Output isn't correct
70 Incorrect 259 ms 23864 KB Output isn't correct
71 Incorrect 397 ms 30920 KB Output isn't correct
72 Incorrect 401 ms 30920 KB Output isn't correct
73 Incorrect 422 ms 30864 KB Output isn't correct
74 Incorrect 422 ms 30888 KB Output isn't correct
75 Incorrect 425 ms 30924 KB Output isn't correct
76 Incorrect 409 ms 30968 KB Output isn't correct
77 Incorrect 401 ms 30804 KB Output isn't correct
78 Incorrect 406 ms 30916 KB Output isn't correct
79 Incorrect 416 ms 30916 KB Output isn't correct
80 Incorrect 401 ms 30916 KB Output isn't correct
81 Incorrect 401 ms 30860 KB Output isn't correct
82 Incorrect 409 ms 31040 KB Output isn't correct
83 Incorrect 402 ms 30916 KB Output isn't correct
84 Incorrect 409 ms 30924 KB Output isn't correct
85 Incorrect 404 ms 30884 KB Output isn't correct
86 Incorrect 422 ms 31120 KB Output isn't correct
87 Incorrect 406 ms 30920 KB Output isn't correct
88 Incorrect 404 ms 30820 KB Output isn't correct
89 Incorrect 408 ms 30912 KB Output isn't correct
90 Incorrect 260 ms 23792 KB Output isn't correct
91 Incorrect 403 ms 30888 KB Output isn't correct
92 Incorrect 408 ms 30832 KB Output isn't correct
93 Incorrect 396 ms 30908 KB Output isn't correct
94 Incorrect 401 ms 30892 KB Output isn't correct
95 Incorrect 398 ms 30936 KB Output isn't correct
96 Incorrect 398 ms 30976 KB Output isn't correct
97 Incorrect 403 ms 30920 KB Output isn't correct
98 Incorrect 399 ms 30916 KB Output isn't correct
99 Incorrect 396 ms 30888 KB Output isn't correct
100 Incorrect 394 ms 30872 KB Output isn't correct