Submission #452066

# Submission time Handle Problem Language Result Execution time Memory
452066 2021-08-03T17:43:37 Z dxz05 Bomb (IZhO17_bomb) C++14
18 / 100
153 ms 12716 KB
#pragma GCC optimize("Ofast,O2,O3")
#pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << "[" << H << "]";
    debug_out(T...);
}

#ifdef dddxxz
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SZ(s) ((int)s.size())
#define all(x) (x).begin(), (x).end()
#define revall(x) (x).rbegin(), (x).rend()

clock_t startTime;

double getCurrentTime() {
    return (double) (clock() - startTime) / CLOCKS_PER_SEC;
}

#define MP make_pair

typedef long long ll;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const double eps = 0.00001;
const int MOD = 1e9;
const int INF = 1000000101;
const long long LLINF = 1223372000000000555;
const int N = 2e6 + 3e2;
const int M = 2522;

char a[M][M];

void solve(int TC) {
    int n, m;
    cin >> n >> m;

    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            cin >> a[i][j];
        }
    }

    int A = n, B = m;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            if (a[i][j] == '0') continue;
            int k = j;
            while (k <= m && a[i][k] == '1') k++;
            A = min(A, k - j);
            j = k - 1;
        }
    }

    for (int j = 1; j <= m; j++){
        for (int i = 1; i <= n; i++){
            if (a[i][j] == '0') continue;
            int k = i;
            while (k <= n && a[k][j] == '1') k++;
            B = min(B, k - i);
            i = k - 1;
        }
    }

    cout << A * B;

}

int main() {
    startTime = clock();
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    bool llololcal = false;
#ifdef dddxxz
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    llololcal = true;
#endif

    int TC = 1;
    //cin >> TC;

    for (int test = 1; test <= TC; test++) {
        debug(test);
        //cout << "Case #" << test << ": ";
        solve(test);
    }

    if (llololcal) cerr << endl << "Time: " << int(getCurrentTime() * 1000) << " ms" << endl;

    return 0;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:19:20: warning: statement has no effect [-Wunused-value]
   19 | #define debug(...) 42
      |                    ^~
bomb.cpp:97:9: note: in expansion of macro 'debug'
   97 |         debug(test);
      |         ^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Incorrect 3 ms 6476 KB Output isn't correct
4 Incorrect 3 ms 6404 KB Output isn't correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Correct 1 ms 332 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 0 ms 324 KB Output is correct
14 Correct 0 ms 328 KB Output is correct
15 Incorrect 0 ms 332 KB Output isn't correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Incorrect 1 ms 456 KB Output isn't correct
19 Incorrect 1 ms 460 KB Output isn't correct
20 Incorrect 1 ms 460 KB Output isn't correct
21 Incorrect 1 ms 456 KB Output isn't correct
22 Incorrect 1 ms 460 KB Output isn't correct
23 Incorrect 1 ms 460 KB Output isn't correct
24 Incorrect 1 ms 452 KB Output isn't correct
25 Incorrect 1 ms 460 KB Output isn't correct
26 Correct 1 ms 460 KB Output is correct
27 Correct 2 ms 1100 KB Output is correct
28 Incorrect 3 ms 1128 KB Output isn't correct
29 Incorrect 4 ms 1356 KB Output isn't correct
30 Incorrect 6 ms 1484 KB Output isn't correct
31 Incorrect 4 ms 1228 KB Output isn't correct
32 Incorrect 4 ms 1484 KB Output isn't correct
33 Incorrect 7 ms 1636 KB Output isn't correct
34 Incorrect 3 ms 1228 KB Output isn't correct
35 Incorrect 5 ms 1616 KB Output isn't correct
36 Correct 4 ms 1620 KB Output is correct
37 Incorrect 1 ms 332 KB Output isn't correct
38 Correct 118 ms 12620 KB Output is correct
39 Incorrect 1 ms 332 KB Output isn't correct
40 Incorrect 17 ms 3256 KB Output isn't correct
41 Incorrect 1 ms 332 KB Output isn't correct
42 Incorrect 1 ms 460 KB Output isn't correct
43 Correct 130 ms 12536 KB Output is correct
44 Incorrect 5 ms 1612 KB Output isn't correct
45 Incorrect 126 ms 12600 KB Output isn't correct
46 Correct 131 ms 12600 KB Output is correct
47 Incorrect 130 ms 12516 KB Output isn't correct
48 Incorrect 130 ms 12572 KB Output isn't correct
49 Correct 120 ms 12480 KB Output is correct
50 Incorrect 126 ms 12488 KB Output isn't correct
51 Incorrect 129 ms 12492 KB Output isn't correct
52 Incorrect 134 ms 12608 KB Output isn't correct
53 Incorrect 130 ms 12580 KB Output isn't correct
54 Incorrect 124 ms 12576 KB Output isn't correct
55 Incorrect 134 ms 12520 KB Output isn't correct
56 Correct 131 ms 12592 KB Output is correct
57 Incorrect 134 ms 12492 KB Output isn't correct
58 Incorrect 132 ms 12484 KB Output isn't correct
59 Incorrect 131 ms 12508 KB Output isn't correct
60 Correct 123 ms 12640 KB Output is correct
61 Correct 120 ms 12604 KB Output is correct
62 Correct 140 ms 12512 KB Output is correct
63 Correct 118 ms 12500 KB Output is correct
64 Correct 137 ms 12564 KB Output is correct
65 Incorrect 144 ms 12664 KB Output isn't correct
66 Incorrect 138 ms 12592 KB Output isn't correct
67 Incorrect 135 ms 12552 KB Output isn't correct
68 Incorrect 129 ms 12512 KB Output isn't correct
69 Incorrect 142 ms 12684 KB Output isn't correct
70 Incorrect 98 ms 9040 KB Output isn't correct
71 Incorrect 140 ms 12584 KB Output isn't correct
72 Incorrect 142 ms 12596 KB Output isn't correct
73 Incorrect 141 ms 12480 KB Output isn't correct
74 Incorrect 144 ms 12484 KB Output isn't correct
75 Incorrect 142 ms 12588 KB Output isn't correct
76 Incorrect 135 ms 12484 KB Output isn't correct
77 Incorrect 139 ms 12508 KB Output isn't correct
78 Incorrect 153 ms 12716 KB Output isn't correct
79 Incorrect 150 ms 12496 KB Output isn't correct
80 Incorrect 141 ms 12524 KB Output isn't correct
81 Incorrect 143 ms 12612 KB Output isn't correct
82 Incorrect 145 ms 12484 KB Output isn't correct
83 Incorrect 141 ms 12592 KB Output isn't correct
84 Incorrect 142 ms 12484 KB Output isn't correct
85 Incorrect 136 ms 12504 KB Output isn't correct
86 Incorrect 130 ms 12524 KB Output isn't correct
87 Incorrect 138 ms 12612 KB Output isn't correct
88 Incorrect 135 ms 12508 KB Output isn't correct
89 Incorrect 134 ms 12588 KB Output isn't correct
90 Incorrect 84 ms 9048 KB Output isn't correct
91 Incorrect 141 ms 12692 KB Output isn't correct
92 Incorrect 141 ms 12600 KB Output isn't correct
93 Incorrect 131 ms 12484 KB Output isn't correct
94 Incorrect 140 ms 12596 KB Output isn't correct
95 Incorrect 150 ms 12596 KB Output isn't correct
96 Incorrect 137 ms 12520 KB Output isn't correct
97 Incorrect 123 ms 12588 KB Output isn't correct
98 Incorrect 141 ms 12616 KB Output isn't correct
99 Incorrect 137 ms 12484 KB Output isn't correct
100 Incorrect 132 ms 12560 KB Output isn't correct