답안 #706363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
706363 2023-03-06T10:32:22 Z nifeshe Bomb (IZhO17_bomb) C++17
24 / 100
182 ms 49484 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 = n;
    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 = m;
    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;
    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")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 0 ms 212 KB Output isn't correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Incorrect 0 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 0 ms 340 KB Output isn't correct
19 Incorrect 1 ms 340 KB Output isn't correct
20 Incorrect 0 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 0 ms 340 KB Output isn't correct
24 Incorrect 1 ms 340 KB Output isn't correct
25 Incorrect 1 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 1816 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 0 ms 212 KB Output isn't correct
38 Correct 152 ms 49352 KB Output is correct
39 Incorrect 1 ms 212 KB Output isn't correct
40 Incorrect 18 ms 6356 KB Output isn't correct
41 Incorrect 1 ms 212 KB Output isn't correct
42 Incorrect 1 ms 340 KB Output isn't correct
43 Correct 151 ms 49352 KB Output is correct
44 Incorrect 4 ms 1876 KB Output isn't correct
45 Incorrect 152 ms 49308 KB Output isn't correct
46 Correct 152 ms 49364 KB Output is correct
47 Incorrect 179 ms 49352 KB Output isn't correct
48 Incorrect 152 ms 49364 KB Output isn't correct
49 Correct 145 ms 49348 KB Output is correct
50 Incorrect 149 ms 49280 KB Output isn't correct
51 Incorrect 151 ms 49348 KB Output isn't correct
52 Incorrect 154 ms 49356 KB Output isn't correct
53 Incorrect 153 ms 49364 KB Output isn't correct
54 Incorrect 164 ms 49364 KB Output isn't correct
55 Incorrect 154 ms 49364 KB Output isn't correct
56 Correct 146 ms 49364 KB Output is correct
57 Incorrect 158 ms 49364 KB Output isn't correct
58 Incorrect 173 ms 49364 KB Output isn't correct
59 Incorrect 152 ms 49364 KB Output isn't correct
60 Correct 150 ms 49292 KB Output is correct
61 Correct 154 ms 49364 KB Output is correct
62 Correct 146 ms 49364 KB Output is correct
63 Correct 150 ms 49364 KB Output is correct
64 Correct 156 ms 49364 KB Output is correct
65 Incorrect 156 ms 49332 KB Output isn't correct
66 Incorrect 153 ms 49348 KB Output isn't correct
67 Incorrect 149 ms 49364 KB Output isn't correct
68 Incorrect 163 ms 49348 KB Output isn't correct
69 Incorrect 151 ms 49364 KB Output isn't correct
70 Incorrect 100 ms 31716 KB Output isn't correct
71 Incorrect 158 ms 49348 KB Output isn't correct
72 Incorrect 157 ms 49292 KB Output isn't correct
73 Incorrect 171 ms 49356 KB Output isn't correct
74 Incorrect 155 ms 49268 KB Output isn't correct
75 Incorrect 182 ms 49364 KB Output isn't correct
76 Incorrect 156 ms 49296 KB Output isn't correct
77 Incorrect 164 ms 49352 KB Output isn't correct
78 Incorrect 154 ms 49356 KB Output isn't correct
79 Incorrect 167 ms 49352 KB Output isn't correct
80 Incorrect 173 ms 49348 KB Output isn't correct
81 Incorrect 161 ms 49412 KB Output isn't correct
82 Incorrect 160 ms 49348 KB Output isn't correct
83 Incorrect 157 ms 49364 KB Output isn't correct
84 Incorrect 161 ms 49332 KB Output isn't correct
85 Incorrect 155 ms 49364 KB Output isn't correct
86 Incorrect 156 ms 49364 KB Output isn't correct
87 Incorrect 150 ms 49352 KB Output isn't correct
88 Incorrect 161 ms 49352 KB Output isn't correct
89 Incorrect 163 ms 49484 KB Output isn't correct
90 Incorrect 99 ms 31636 KB Output isn't correct
91 Incorrect 154 ms 49276 KB Output isn't correct
92 Incorrect 157 ms 49396 KB Output isn't correct
93 Incorrect 151 ms 49332 KB Output isn't correct
94 Incorrect 154 ms 49364 KB Output isn't correct
95 Incorrect 171 ms 49368 KB Output isn't correct
96 Incorrect 158 ms 49448 KB Output isn't correct
97 Incorrect 149 ms 49272 KB Output isn't correct
98 Incorrect 157 ms 49260 KB Output isn't correct
99 Incorrect 160 ms 49364 KB Output isn't correct
100 Incorrect 153 ms 49300 KB Output isn't correct