Submission #167063

# Submission time Handle Problem Language Result Execution time Memory
167063 2019-12-05T12:12:02 Z hentai_lover Bomb (IZhO17_bomb) C++14
15 / 100
1000 ms 12792 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#define pb push_back
#define fr(i, l, r) for(ll i = l; i <= r; ++ i)
#define rf(i, l, r) for(ll i = l; i >= r; -- i)

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using _set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef int ll;
typedef pair<ll, ll> pll;

const ll oo = ll(1e9) + 10;

int main() {
    //ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll n, m, ansx = oo, ansy = oo;
    cin >> n >> m;
    char a[n + 1][m + 1];
    fr(i, 1, n)fr(j, 1, m)cin >> a[i][j];

    fr(i, 1, n){
        fr(j, 1, m){
            if(a[i][j] == '0')continue;
            ll l = -1, r = -1, u = -1, d = -1;
            fr(x, i, n){
                if(a[x][j] == '0')break;
                r = x;
            }
            if(r < 0)r = n;
            rf(x, i, 1){
                if(a[x][j] == '0')break;
                l = x;
            }
            if(l < 0)l = 1;
            fr(x, j, m){
                if(a[i][x] == '0')break;
                d = x;
            }
            if(d < 0)d = m;
            rf(x, j, 1){
                //cout << "u = " << u << " i = " << i << " x = " << x << " a[i][x] = " << a[i][x] << endl;
                if(a[i][x] == '0')break;
                u = x;
            }
            if(u < 0)u = 1;


            ll a = r - l + 1;
            ll b = d - u + 1;
            //cout << "i = " << i << " j = " << j << "a = " << a << " b = " << b << " u = " << u << " d = " << d << endl;
            ansx = min(ansx, a);
            ansy = min(ansy, b);
        }
    }
    //cout << ansx << ' ' << ansy << endl;
    cout << ansx * ansy << endl;
}


/*
3 3
1 5 1
2 3
1 3 5
2 3
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Incorrect 2 ms 256 KB Output isn't correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Incorrect 2 ms 256 KB Output isn't correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Incorrect 2 ms 376 KB Output isn't correct
19 Incorrect 3 ms 256 KB Output isn't correct
20 Incorrect 3 ms 256 KB Output isn't correct
21 Incorrect 2 ms 252 KB Output isn't correct
22 Incorrect 3 ms 376 KB Output isn't correct
23 Incorrect 3 ms 376 KB Output isn't correct
24 Incorrect 3 ms 376 KB Output isn't correct
25 Incorrect 3 ms 376 KB Output isn't correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 40 ms 504 KB Output is correct
28 Incorrect 13 ms 504 KB Output isn't correct
29 Incorrect 64 ms 504 KB Output isn't correct
30 Incorrect 30 ms 760 KB Output isn't correct
31 Incorrect 22 ms 632 KB Output isn't correct
32 Incorrect 21 ms 632 KB Output isn't correct
33 Incorrect 40 ms 760 KB Output isn't correct
34 Incorrect 10 ms 504 KB Output isn't correct
35 Incorrect 25 ms 760 KB Output isn't correct
36 Correct 169 ms 792 KB Output is correct
37 Incorrect 2 ms 256 KB Output isn't correct
38 Execution timed out 1069 ms 12636 KB Time limit exceeded
39 Incorrect 2 ms 380 KB Output isn't correct
40 Incorrect 922 ms 1912 KB Output isn't correct
41 Incorrect 2 ms 256 KB Output isn't correct
42 Incorrect 4 ms 376 KB Output isn't correct
43 Execution timed out 1085 ms 12604 KB Time limit exceeded
44 Incorrect 85 ms 632 KB Output isn't correct
45 Execution timed out 1078 ms 12664 KB Time limit exceeded
46 Correct 776 ms 12664 KB Output is correct
47 Execution timed out 1076 ms 12664 KB Time limit exceeded
48 Execution timed out 1080 ms 12604 KB Time limit exceeded
49 Execution timed out 1081 ms 12664 KB Time limit exceeded
50 Execution timed out 1082 ms 12568 KB Time limit exceeded
51 Execution timed out 1075 ms 12608 KB Time limit exceeded
52 Execution timed out 1075 ms 12688 KB Time limit exceeded
53 Execution timed out 1084 ms 12496 KB Time limit exceeded
54 Execution timed out 1081 ms 12676 KB Time limit exceeded
55 Execution timed out 1073 ms 12664 KB Time limit exceeded
56 Execution timed out 1076 ms 12608 KB Time limit exceeded
57 Execution timed out 1075 ms 12680 KB Time limit exceeded
58 Execution timed out 1079 ms 12664 KB Time limit exceeded
59 Execution timed out 1072 ms 12768 KB Time limit exceeded
60 Execution timed out 1082 ms 12536 KB Time limit exceeded
61 Execution timed out 1083 ms 12664 KB Time limit exceeded
62 Execution timed out 1081 ms 12668 KB Time limit exceeded
63 Execution timed out 1069 ms 12720 KB Time limit exceeded
64 Execution timed out 1070 ms 12716 KB Time limit exceeded
65 Execution timed out 1077 ms 12664 KB Time limit exceeded
66 Execution timed out 1087 ms 12536 KB Time limit exceeded
67 Execution timed out 1072 ms 12664 KB Time limit exceeded
68 Execution timed out 1077 ms 12664 KB Time limit exceeded
69 Execution timed out 1062 ms 12592 KB Time limit exceeded
70 Incorrect 793 ms 8284 KB Output isn't correct
71 Execution timed out 1079 ms 12692 KB Time limit exceeded
72 Execution timed out 1075 ms 12536 KB Time limit exceeded
73 Execution timed out 1085 ms 12584 KB Time limit exceeded
74 Execution timed out 1079 ms 12664 KB Time limit exceeded
75 Execution timed out 1082 ms 12664 KB Time limit exceeded
76 Execution timed out 1069 ms 12536 KB Time limit exceeded
77 Execution timed out 1085 ms 12664 KB Time limit exceeded
78 Execution timed out 1082 ms 12636 KB Time limit exceeded
79 Incorrect 628 ms 12588 KB Output isn't correct
80 Incorrect 623 ms 12596 KB Output isn't correct
81 Incorrect 721 ms 12664 KB Output isn't correct
82 Execution timed out 1069 ms 12688 KB Time limit exceeded
83 Execution timed out 1075 ms 12792 KB Time limit exceeded
84 Incorrect 612 ms 12604 KB Output isn't correct
85 Execution timed out 1072 ms 12668 KB Time limit exceeded
86 Execution timed out 1078 ms 12792 KB Time limit exceeded
87 Execution timed out 1067 ms 12536 KB Time limit exceeded
88 Execution timed out 1070 ms 12548 KB Time limit exceeded
89 Execution timed out 1089 ms 12664 KB Time limit exceeded
90 Execution timed out 1072 ms 8056 KB Time limit exceeded
91 Execution timed out 1057 ms 12548 KB Time limit exceeded
92 Execution timed out 1044 ms 12548 KB Time limit exceeded
93 Execution timed out 1072 ms 12468 KB Time limit exceeded
94 Execution timed out 1053 ms 12520 KB Time limit exceeded
95 Execution timed out 1051 ms 12568 KB Time limit exceeded
96 Execution timed out 1075 ms 12552 KB Time limit exceeded
97 Execution timed out 1058 ms 12548 KB Time limit exceeded
98 Execution timed out 1077 ms 12540 KB Time limit exceeded
99 Execution timed out 1075 ms 12568 KB Time limit exceeded
100 Execution timed out 1063 ms 12480 KB Time limit exceeded