Submission #452073

# Submission time Handle Problem Language Result Execution time Memory
452073 2021-08-03T18:06:34 Z dxz05 Bomb (IZhO17_bomb) C++14
24 / 100
135 ms 7384 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 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++;
            A = min(A, k - i);
            i = k - 1;
        }
    }

    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++;
            B = min(B, k - j);
            j = 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 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 3 ms 6476 KB Output is correct
4 Correct 3 ms 6476 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Incorrect 0 ms 332 KB Output isn't correct
10 Incorrect 1 ms 324 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 320 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Incorrect 1 ms 460 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 460 KB Output isn't correct
22 Incorrect 1 ms 460 KB Output isn't correct
23 Incorrect 1 ms 588 KB Output isn't correct
24 Incorrect 1 ms 460 KB Output isn't correct
25 Incorrect 1 ms 588 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 1100 KB Output isn't correct
29 Incorrect 3 ms 1356 KB Output isn't correct
30 Incorrect 5 ms 1484 KB Output isn't correct
31 Incorrect 4 ms 1252 KB Output isn't correct
32 Incorrect 4 ms 1484 KB Output isn't correct
33 Incorrect 5 ms 1616 KB Output isn't correct
34 Incorrect 2 ms 1228 KB Output isn't correct
35 Incorrect 5 ms 1612 KB Output isn't correct
36 Correct 4 ms 1612 KB Output is correct
37 Incorrect 0 ms 332 KB Output isn't correct
38 Correct 120 ms 7184 KB Output is correct
39 Incorrect 1 ms 332 KB Output isn't correct
40 Incorrect 14 ms 3184 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 122 ms 7208 KB Output is correct
44 Incorrect 5 ms 1612 KB Output isn't correct
45 Incorrect 126 ms 7256 KB Output isn't correct
46 Correct 122 ms 7248 KB Output is correct
47 Incorrect 122 ms 7208 KB Output isn't correct
48 Incorrect 125 ms 7184 KB Output isn't correct
49 Correct 119 ms 7260 KB Output is correct
50 Incorrect 126 ms 7192 KB Output isn't correct
51 Incorrect 125 ms 7244 KB Output isn't correct
52 Incorrect 128 ms 7384 KB Output isn't correct
53 Incorrect 125 ms 7268 KB Output isn't correct
54 Incorrect 127 ms 7232 KB Output isn't correct
55 Incorrect 128 ms 7236 KB Output isn't correct
56 Correct 126 ms 7324 KB Output is correct
57 Incorrect 127 ms 7164 KB Output isn't correct
58 Incorrect 122 ms 7236 KB Output isn't correct
59 Incorrect 126 ms 7144 KB Output isn't correct
60 Correct 121 ms 7236 KB Output is correct
61 Correct 115 ms 7236 KB Output is correct
62 Correct 109 ms 7148 KB Output is correct
63 Correct 119 ms 7160 KB Output is correct
64 Correct 126 ms 7132 KB Output is correct
65 Incorrect 124 ms 7108 KB Output isn't correct
66 Incorrect 124 ms 7108 KB Output isn't correct
67 Incorrect 122 ms 7160 KB Output isn't correct
68 Incorrect 123 ms 7076 KB Output isn't correct
69 Incorrect 127 ms 7076 KB Output isn't correct
70 Incorrect 80 ms 5956 KB Output isn't correct
71 Incorrect 129 ms 7108 KB Output isn't correct
72 Incorrect 127 ms 7088 KB Output isn't correct
73 Incorrect 133 ms 7108 KB Output isn't correct
74 Incorrect 126 ms 7116 KB Output isn't correct
75 Incorrect 131 ms 7184 KB Output isn't correct
76 Incorrect 130 ms 7032 KB Output isn't correct
77 Incorrect 126 ms 7020 KB Output isn't correct
78 Incorrect 120 ms 7108 KB Output isn't correct
79 Incorrect 130 ms 7108 KB Output isn't correct
80 Incorrect 132 ms 7016 KB Output isn't correct
81 Incorrect 135 ms 6980 KB Output isn't correct
82 Incorrect 123 ms 7004 KB Output isn't correct
83 Incorrect 127 ms 6944 KB Output isn't correct
84 Incorrect 129 ms 6980 KB Output isn't correct
85 Incorrect 126 ms 6972 KB Output isn't correct
86 Incorrect 118 ms 6972 KB Output isn't correct
87 Incorrect 133 ms 6952 KB Output isn't correct
88 Incorrect 130 ms 6960 KB Output isn't correct
89 Incorrect 127 ms 7048 KB Output isn't correct
90 Incorrect 75 ms 5636 KB Output isn't correct
91 Incorrect 125 ms 6976 KB Output isn't correct
92 Incorrect 126 ms 6876 KB Output isn't correct
93 Incorrect 120 ms 6980 KB Output isn't correct
94 Incorrect 130 ms 6956 KB Output isn't correct
95 Incorrect 126 ms 6956 KB Output isn't correct
96 Incorrect 130 ms 6980 KB Output isn't correct
97 Incorrect 125 ms 7012 KB Output isn't correct
98 Incorrect 126 ms 6948 KB Output isn't correct
99 Incorrect 124 ms 6892 KB Output isn't correct
100 Incorrect 121 ms 6848 KB Output isn't correct