Submission #422196

# Submission time Handle Problem Language Result Execution time Memory
422196 2021-06-09T20:55:02 Z antimirage Bomb (IZhO17_bomb) C++14
24 / 100
437 ms 29084 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) 
        w = m, h = n;
   
    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 5 ms 10316 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 300 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 2 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 716 KB Output isn't correct
26 Correct 1 ms 692 KB Output is correct
27 Correct 7 ms 1868 KB Output is correct
28 Incorrect 7 ms 1996 KB Output isn't correct
29 Incorrect 9 ms 2400 KB Output isn't correct
30 Incorrect 12 ms 2896 KB Output isn't correct
31 Incorrect 10 ms 2380 KB Output isn't correct
32 Incorrect 10 ms 2596 KB Output isn't correct
33 Incorrect 12 ms 3020 KB Output isn't correct
34 Incorrect 6 ms 2124 KB Output isn't correct
35 Incorrect 13 ms 3092 KB Output isn't correct
36 Correct 12 ms 2972 KB Output is correct
37 Incorrect 1 ms 332 KB Output isn't correct
38 Correct 398 ms 29060 KB Output is correct
39 Incorrect 1 ms 332 KB Output isn't correct
40 Incorrect 45 ms 7528 KB Output isn't correct
41 Incorrect 1 ms 332 KB Output isn't correct
42 Incorrect 2 ms 716 KB Output isn't correct
43 Correct 437 ms 28960 KB Output is correct
44 Incorrect 12 ms 3020 KB Output isn't correct
45 Incorrect 403 ms 28960 KB Output isn't correct
46 Correct 407 ms 28908 KB Output is correct
47 Incorrect 428 ms 28964 KB Output isn't correct
48 Incorrect 403 ms 28960 KB Output isn't correct
49 Correct 413 ms 28952 KB Output is correct
50 Incorrect 401 ms 28976 KB Output isn't correct
51 Incorrect 405 ms 28964 KB Output isn't correct
52 Incorrect 390 ms 29068 KB Output isn't correct
53 Incorrect 394 ms 28956 KB Output isn't correct
54 Incorrect 395 ms 28996 KB Output isn't correct
55 Incorrect 390 ms 28944 KB Output isn't correct
56 Correct 397 ms 28984 KB Output is correct
57 Incorrect 432 ms 28908 KB Output isn't correct
58 Incorrect 416 ms 29000 KB Output isn't correct
59 Incorrect 387 ms 29084 KB Output isn't correct
60 Correct 407 ms 28864 KB Output is correct
61 Correct 406 ms 28912 KB Output is correct
62 Correct 390 ms 28964 KB Output is correct
63 Correct 385 ms 28856 KB Output is correct
64 Correct 402 ms 28848 KB Output is correct
65 Incorrect 390 ms 29072 KB Output isn't correct
66 Incorrect 395 ms 28936 KB Output isn't correct
67 Incorrect 393 ms 28900 KB Output isn't correct
68 Incorrect 393 ms 28852 KB Output isn't correct
69 Incorrect 408 ms 28960 KB Output isn't correct
70 Incorrect 278 ms 23744 KB Output isn't correct
71 Incorrect 396 ms 28832 KB Output isn't correct
72 Incorrect 385 ms 28836 KB Output isn't correct
73 Incorrect 406 ms 28620 KB Output isn't correct
74 Incorrect 391 ms 28632 KB Output isn't correct
75 Incorrect 392 ms 28688 KB Output isn't correct
76 Incorrect 385 ms 28708 KB Output isn't correct
77 Incorrect 418 ms 28476 KB Output isn't correct
78 Incorrect 404 ms 28528 KB Output isn't correct
79 Incorrect 387 ms 28492 KB Output isn't correct
80 Incorrect 405 ms 28672 KB Output isn't correct
81 Incorrect 427 ms 28552 KB Output isn't correct
82 Incorrect 393 ms 28512 KB Output isn't correct
83 Incorrect 386 ms 28456 KB Output isn't correct
84 Incorrect 387 ms 28488 KB Output isn't correct
85 Incorrect 391 ms 28308 KB Output isn't correct
86 Incorrect 380 ms 28356 KB Output isn't correct
87 Incorrect 386 ms 28268 KB Output isn't correct
88 Incorrect 381 ms 28212 KB Output isn't correct
89 Incorrect 397 ms 28088 KB Output isn't correct
90 Incorrect 249 ms 23228 KB Output isn't correct
91 Incorrect 398 ms 28020 KB Output isn't correct
92 Incorrect 390 ms 27972 KB Output isn't correct
93 Incorrect 394 ms 27836 KB Output isn't correct
94 Incorrect 396 ms 27844 KB Output isn't correct
95 Incorrect 392 ms 27728 KB Output isn't correct
96 Incorrect 402 ms 27556 KB Output isn't correct
97 Incorrect 385 ms 27364 KB Output isn't correct
98 Incorrect 397 ms 27648 KB Output isn't correct
99 Incorrect 399 ms 27440 KB Output isn't correct
100 Incorrect 410 ms 27424 KB Output isn't correct