Submission #167064

# Submission time Handle Problem Language Result Execution time Memory
167064 2019-12-05T12:13:03 Z hentai_lover Bomb (IZhO17_bomb) C++14
14 / 100
171 ms 760 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;
    if(min(n, m) > 500)return 0;
    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 376 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 Incorrect 2 ms 256 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 256 KB Output is correct
15 Incorrect 2 ms 256 KB Output isn't correct
16 Correct 2 ms 252 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Incorrect 3 ms 256 KB Output isn't correct
19 Incorrect 3 ms 376 KB Output isn't correct
20 Incorrect 3 ms 376 KB Output isn't correct
21 Incorrect 3 ms 256 KB Output isn't correct
22 Incorrect 3 ms 256 KB Output isn't correct
23 Incorrect 3 ms 376 KB Output isn't correct
24 Incorrect 3 ms 256 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 512 KB Output is correct
28 Incorrect 13 ms 504 KB Output isn't correct
29 Incorrect 72 ms 632 KB Output isn't correct
30 Incorrect 30 ms 712 KB Output isn't correct
31 Incorrect 22 ms 632 KB Output isn't correct
32 Incorrect 21 ms 636 KB Output isn't correct
33 Incorrect 40 ms 556 KB Output isn't correct
34 Incorrect 10 ms 504 KB Output isn't correct
35 Incorrect 23 ms 632 KB Output isn't correct
36 Correct 171 ms 756 KB Output is correct
37 Incorrect 2 ms 256 KB Output isn't correct
38 Incorrect 2 ms 256 KB Output isn't correct
39 Incorrect 2 ms 376 KB Output isn't correct
40 Incorrect 2 ms 256 KB Output isn't correct
41 Incorrect 2 ms 376 KB Output isn't correct
42 Incorrect 4 ms 376 KB Output isn't correct
43 Incorrect 2 ms 256 KB Output isn't correct
44 Incorrect 85 ms 760 KB Output isn't correct
45 Incorrect 2 ms 256 KB Output isn't correct
46 Incorrect 2 ms 256 KB Output isn't correct
47 Incorrect 2 ms 376 KB Output isn't correct
48 Incorrect 2 ms 256 KB Output isn't correct
49 Incorrect 2 ms 256 KB Output isn't correct
50 Incorrect 2 ms 256 KB Output isn't correct
51 Incorrect 2 ms 256 KB Output isn't correct
52 Incorrect 2 ms 376 KB Output isn't correct
53 Incorrect 2 ms 376 KB Output isn't correct
54 Incorrect 2 ms 376 KB Output isn't correct
55 Incorrect 2 ms 256 KB Output isn't correct
56 Incorrect 2 ms 256 KB Output isn't correct
57 Incorrect 2 ms 376 KB Output isn't correct
58 Incorrect 2 ms 256 KB Output isn't correct
59 Incorrect 2 ms 256 KB Output isn't correct
60 Incorrect 2 ms 380 KB Output isn't correct
61 Incorrect 2 ms 256 KB Output isn't correct
62 Incorrect 2 ms 376 KB Output isn't correct
63 Incorrect 2 ms 376 KB Output isn't correct
64 Incorrect 2 ms 256 KB Output isn't correct
65 Incorrect 2 ms 256 KB Output isn't correct
66 Incorrect 2 ms 376 KB Output isn't correct
67 Incorrect 2 ms 256 KB Output isn't correct
68 Incorrect 2 ms 256 KB Output isn't correct
69 Incorrect 2 ms 376 KB Output isn't correct
70 Incorrect 2 ms 256 KB Output isn't correct
71 Incorrect 2 ms 376 KB Output isn't correct
72 Incorrect 2 ms 376 KB Output isn't correct
73 Incorrect 2 ms 252 KB Output isn't correct
74 Incorrect 2 ms 256 KB Output isn't correct
75 Incorrect 2 ms 376 KB Output isn't correct
76 Incorrect 2 ms 256 KB Output isn't correct
77 Incorrect 2 ms 256 KB Output isn't correct
78 Incorrect 2 ms 376 KB Output isn't correct
79 Incorrect 2 ms 252 KB Output isn't correct
80 Incorrect 2 ms 348 KB Output isn't correct
81 Incorrect 2 ms 376 KB Output isn't correct
82 Incorrect 2 ms 256 KB Output isn't correct
83 Incorrect 2 ms 256 KB Output isn't correct
84 Incorrect 2 ms 256 KB Output isn't correct
85 Incorrect 2 ms 256 KB Output isn't correct
86 Incorrect 2 ms 256 KB Output isn't correct
87 Incorrect 2 ms 376 KB Output isn't correct
88 Incorrect 2 ms 256 KB Output isn't correct
89 Incorrect 2 ms 256 KB Output isn't correct
90 Incorrect 2 ms 376 KB Output isn't correct
91 Incorrect 2 ms 256 KB Output isn't correct
92 Incorrect 2 ms 256 KB Output isn't correct
93 Incorrect 2 ms 256 KB Output isn't correct
94 Incorrect 2 ms 348 KB Output isn't correct
95 Incorrect 2 ms 256 KB Output isn't correct
96 Incorrect 2 ms 256 KB Output isn't correct
97 Incorrect 2 ms 256 KB Output isn't correct
98 Incorrect 2 ms 256 KB Output isn't correct
99 Incorrect 2 ms 256 KB Output isn't correct
100 Incorrect 2 ms 376 KB Output isn't correct