Submission #706353

# Submission time Handle Problem Language Result Execution time Memory
706353 2023-03-06T10:21:25 Z nifeshe Bomb (IZhO17_bomb) C++17
18 / 100
199 ms 49408 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma comment (linker, "/STACK: 16777216")

#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define int long long

using namespace std;
using namespace __gnu_pbds;

template <typename T> inline bool umax(T &a, const T &b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool umin(T &a, const T &b) { if(a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> using oset = tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod = 998244353;
const ll base = 1e6 + 5;
const ll inf = 1e18;
const int MAX = 5e5 + 1;
const int LG = 20;

random_device rd;
mt19937 gen(rd());
uniform_int_distribution<ll> dis(1, inf);

void solve() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            char c;
            cin >> c;
            a[i][j] = c - '0';
        }
    }
    int L = m;
    for(int j = 0; j < m; j++) {
        int cons = 0;
        for(int i = 0; i < n; i++) {
            if(!a[i][j]) {
                if(cons) umin(L, cons);
                cons = 0;
            }
            else cons++;
        }
        if(cons) umin(L, cons);
    }
    int H = n;
    for(int i = 0; i < n; i++) {
        int cons = 0;
        for(int j = 0; j < m; j++) {
            if(!a[i][j]) {
                if(cons) umin(H, cons);
                cons = 0;
            }
            else cons++;
        }
        if(cons) umin(H, cons);
    }
    int ans = L * H;
    if(!ans) ans = n * m;
    cout << ans << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int ttt = 1;
//    cin >> ttt;
    while(ttt--) {
        solve();
    }
    return 0;
}

Compilation message

bomb.cpp:8: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    8 | #pragma comment (linker, "/STACK: 16777216")
      |
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Incorrect 0 ms 468 KB Output isn't correct
4 Incorrect 0 ms 468 KB Output isn't correct
5 Incorrect 0 ms 340 KB Output isn't correct
6 Incorrect 0 ms 340 KB Output isn't correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Incorrect 1 ms 212 KB Output isn't correct
10 Incorrect 1 ms 212 KB Output isn't correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Incorrect 0 ms 212 KB Output isn't correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Incorrect 1 ms 340 KB Output isn't correct
19 Incorrect 1 ms 284 KB Output isn't correct
20 Incorrect 1 ms 340 KB Output isn't correct
21 Incorrect 1 ms 340 KB Output isn't correct
22 Incorrect 1 ms 340 KB Output isn't correct
23 Incorrect 1 ms 340 KB Output isn't correct
24 Incorrect 0 ms 340 KB Output isn't correct
25 Incorrect 0 ms 340 KB Output isn't correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 2 ms 852 KB Output is correct
28 Incorrect 3 ms 1108 KB Output isn't correct
29 Incorrect 3 ms 1236 KB Output isn't correct
30 Incorrect 4 ms 1748 KB Output isn't correct
31 Incorrect 3 ms 1492 KB Output isn't correct
32 Incorrect 3 ms 1492 KB Output isn't correct
33 Incorrect 4 ms 1876 KB Output isn't correct
34 Incorrect 2 ms 980 KB Output isn't correct
35 Incorrect 4 ms 1876 KB Output isn't correct
36 Correct 5 ms 1876 KB Output is correct
37 Incorrect 1 ms 212 KB Output isn't correct
38 Correct 165 ms 49352 KB Output is correct
39 Incorrect 0 ms 212 KB Output isn't correct
40 Incorrect 15 ms 6356 KB Output isn't correct
41 Incorrect 0 ms 212 KB Output isn't correct
42 Incorrect 0 ms 340 KB Output isn't correct
43 Correct 148 ms 49364 KB Output is correct
44 Incorrect 4 ms 1876 KB Output isn't correct
45 Incorrect 150 ms 49364 KB Output isn't correct
46 Correct 184 ms 49356 KB Output is correct
47 Incorrect 174 ms 49352 KB Output isn't correct
48 Incorrect 164 ms 49364 KB Output isn't correct
49 Correct 164 ms 49352 KB Output is correct
50 Incorrect 160 ms 49296 KB Output isn't correct
51 Incorrect 151 ms 49364 KB Output isn't correct
52 Incorrect 157 ms 49352 KB Output isn't correct
53 Incorrect 159 ms 49348 KB Output isn't correct
54 Incorrect 166 ms 49368 KB Output isn't correct
55 Incorrect 150 ms 49364 KB Output isn't correct
56 Correct 153 ms 49364 KB Output is correct
57 Incorrect 165 ms 49408 KB Output isn't correct
58 Incorrect 156 ms 49364 KB Output isn't correct
59 Incorrect 158 ms 49228 KB Output isn't correct
60 Correct 168 ms 49348 KB Output is correct
61 Correct 159 ms 49352 KB Output is correct
62 Correct 148 ms 49364 KB Output is correct
63 Correct 156 ms 49364 KB Output is correct
64 Correct 151 ms 49364 KB Output is correct
65 Incorrect 156 ms 49364 KB Output isn't correct
66 Incorrect 149 ms 49244 KB Output isn't correct
67 Incorrect 154 ms 49364 KB Output isn't correct
68 Incorrect 159 ms 49364 KB Output isn't correct
69 Incorrect 162 ms 49260 KB Output isn't correct
70 Incorrect 97 ms 31720 KB Output isn't correct
71 Incorrect 151 ms 49348 KB Output isn't correct
72 Incorrect 157 ms 49356 KB Output isn't correct
73 Incorrect 153 ms 49364 KB Output isn't correct
74 Incorrect 167 ms 49356 KB Output isn't correct
75 Incorrect 153 ms 49288 KB Output isn't correct
76 Incorrect 154 ms 49364 KB Output isn't correct
77 Incorrect 154 ms 49364 KB Output isn't correct
78 Incorrect 152 ms 49348 KB Output isn't correct
79 Incorrect 154 ms 49364 KB Output isn't correct
80 Incorrect 156 ms 49264 KB Output isn't correct
81 Incorrect 162 ms 49364 KB Output isn't correct
82 Incorrect 165 ms 49364 KB Output isn't correct
83 Incorrect 176 ms 49364 KB Output isn't correct
84 Incorrect 168 ms 49348 KB Output isn't correct
85 Incorrect 199 ms 49304 KB Output isn't correct
86 Incorrect 156 ms 49356 KB Output isn't correct
87 Incorrect 166 ms 49364 KB Output isn't correct
88 Incorrect 152 ms 49352 KB Output isn't correct
89 Incorrect 154 ms 49364 KB Output isn't correct
90 Incorrect 105 ms 31700 KB Output isn't correct
91 Incorrect 155 ms 49292 KB Output isn't correct
92 Incorrect 152 ms 49364 KB Output isn't correct
93 Incorrect 159 ms 49352 KB Output isn't correct
94 Incorrect 189 ms 49364 KB Output isn't correct
95 Incorrect 178 ms 49364 KB Output isn't correct
96 Incorrect 160 ms 49364 KB Output isn't correct
97 Incorrect 148 ms 49348 KB Output isn't correct
98 Incorrect 171 ms 49364 KB Output isn't correct
99 Incorrect 192 ms 49352 KB Output isn't correct
100 Incorrect 173 ms 49348 KB Output isn't correct