Submission #44550

# Submission time Handle Problem Language Result Execution time Memory
44550 2018-04-03T05:19:38 Z nickyrio Bomb (IZhO17_bomb) C++17
24 / 100
111 ms 131072 KB
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a) for (int i = 0; i < (a); ++i)
#define DEBUG(x) { cerr << #x << '=' << x << endl; }
#define Arr(a, l, r) { cerr << #a << " = {"; FOR(_, l, r) cerr << ' ' << a[_]; cerr << "}\n"; }
#define N 2505
#define pp pair<int, int>
#define endl '\n'
#define IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define taskname ""
#define bit(S, i) (((S) >> (i)) & 1)
using namespace std;
string st[N];

int main() {
    #ifdef NERO
    freopen("test.inp","r",stdin);
    freopen("test.out","w",stdout);
    double stime = clock();
    #else 
        //freopen(taskname".inp","r",stdin);
        //freopen(taskname".out","w",stdout);
    #endif //NERO
    IO;
    int n, m;
    cin >> m >> n;
    FOR(i, 1, m) {
        cin >> st[i];
        st[i] = '0' + st[i] + '0';
    }
    FOR(i, 0, n + 1) st[0].push_back('0');
    st[m + 1] = st[0];
    int w = n;
    FOR(i, 1, m) {
        int zero = 0;
        FOR(j, 1, n + 1) {
            if (st[i][j] == '0') {
                if (zero + 1 != j) w = min(w, j - zero - 1);
                zero = j;
            }
        }
    } 
    int h = m;
    FOR(j, 1, n) {
        int zero = 0;
        FOR(i, 1, m + 1) {
            if (st[i][j] == '0') {
                if (zero + 1 != i) h = min(h, i - zero - 1);
                zero = i;
            }
        }
    }
    cout << h * w;
    #ifdef NERO
    double etime = clock();
    cerr << "Execution time: " << (etime - stime) / CLOCKS_PER_SEC * 1000 << " ms.\n";
    #endif // NERO
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 740 KB Output is correct
3 Correct 2 ms 860 KB Output is correct
4 Correct 2 ms 860 KB Output is correct
5 Correct 2 ms 860 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Incorrect 2 ms 860 KB Output isn't correct
9 Incorrect 2 ms 880 KB Output isn't correct
10 Incorrect 2 ms 880 KB Output isn't correct
11 Incorrect 2 ms 932 KB Output isn't correct
12 Incorrect 2 ms 932 KB Output isn't correct
13 Correct 2 ms 932 KB Output is correct
14 Correct 2 ms 1008 KB Output is correct
15 Incorrect 2 ms 1008 KB Output isn't correct
16 Correct 2 ms 1008 KB Output is correct
17 Correct 2 ms 1060 KB Output is correct
18 Incorrect 2 ms 1060 KB Output isn't correct
19 Incorrect 2 ms 1060 KB Output isn't correct
20 Incorrect 2 ms 1060 KB Output isn't correct
21 Incorrect 2 ms 1060 KB Output isn't correct
22 Incorrect 2 ms 1060 KB Output isn't correct
23 Incorrect 3 ms 1060 KB Output isn't correct
24 Incorrect 2 ms 1060 KB Output isn't correct
25 Incorrect 2 ms 1064 KB Output isn't correct
26 Correct 2 ms 1076 KB Output is correct
27 Correct 3 ms 1344 KB Output is correct
28 Incorrect 3 ms 1552 KB Output isn't correct
29 Incorrect 4 ms 1664 KB Output isn't correct
30 Incorrect 4 ms 1916 KB Output isn't correct
31 Incorrect 3 ms 2100 KB Output isn't correct
32 Incorrect 3 ms 2248 KB Output isn't correct
33 Incorrect 4 ms 2532 KB Output isn't correct
34 Incorrect 3 ms 2532 KB Output isn't correct
35 Incorrect 4 ms 2816 KB Output isn't correct
36 Correct 3 ms 3016 KB Output is correct
37 Incorrect 2 ms 3016 KB Output isn't correct
38 Correct 70 ms 21012 KB Output is correct
39 Incorrect 2 ms 21012 KB Output isn't correct
40 Incorrect 7 ms 21012 KB Output isn't correct
41 Incorrect 2 ms 21012 KB Output isn't correct
42 Incorrect 2 ms 21012 KB Output isn't correct
43 Correct 69 ms 27920 KB Output is correct
44 Incorrect 4 ms 27920 KB Output isn't correct
45 Incorrect 73 ms 34228 KB Output isn't correct
46 Correct 73 ms 40412 KB Output is correct
47 Incorrect 73 ms 46484 KB Output isn't correct
48 Incorrect 72 ms 52612 KB Output isn't correct
49 Correct 68 ms 58740 KB Output is correct
50 Incorrect 71 ms 64912 KB Output isn't correct
51 Incorrect 68 ms 70996 KB Output isn't correct
52 Incorrect 71 ms 77112 KB Output isn't correct
53 Incorrect 70 ms 83240 KB Output isn't correct
54 Incorrect 74 ms 89368 KB Output isn't correct
55 Incorrect 74 ms 95528 KB Output isn't correct
56 Correct 67 ms 101696 KB Output is correct
57 Incorrect 72 ms 107768 KB Output isn't correct
58 Incorrect 73 ms 113944 KB Output isn't correct
59 Incorrect 67 ms 120024 KB Output isn't correct
60 Correct 70 ms 126200 KB Output is correct
61 Correct 68 ms 131072 KB Output is correct
62 Correct 74 ms 131072 KB Output is correct
63 Correct 73 ms 131072 KB Output is correct
64 Correct 76 ms 131072 KB Output is correct
65 Incorrect 75 ms 131072 KB Output isn't correct
66 Incorrect 83 ms 131072 KB Output isn't correct
67 Incorrect 74 ms 131072 KB Output isn't correct
68 Incorrect 76 ms 131072 KB Output isn't correct
69 Incorrect 86 ms 131072 KB Output isn't correct
70 Incorrect 44 ms 131072 KB Output isn't correct
71 Incorrect 111 ms 131072 KB Output isn't correct
72 Incorrect 83 ms 131072 KB Output isn't correct
73 Incorrect 93 ms 131072 KB Output isn't correct
74 Incorrect 79 ms 131072 KB Output isn't correct
75 Incorrect 80 ms 131072 KB Output isn't correct
76 Incorrect 81 ms 131072 KB Output isn't correct
77 Incorrect 81 ms 131072 KB Output isn't correct
78 Incorrect 78 ms 131072 KB Output isn't correct
79 Incorrect 77 ms 131072 KB Output isn't correct
80 Incorrect 83 ms 131072 KB Output isn't correct
81 Incorrect 82 ms 131072 KB Output isn't correct
82 Incorrect 77 ms 131072 KB Output isn't correct
83 Incorrect 77 ms 131072 KB Output isn't correct
84 Incorrect 78 ms 131072 KB Output isn't correct
85 Incorrect 75 ms 131072 KB Output isn't correct
86 Incorrect 75 ms 131072 KB Output isn't correct
87 Incorrect 74 ms 131072 KB Output isn't correct
88 Incorrect 75 ms 131072 KB Output isn't correct
89 Incorrect 76 ms 131072 KB Output isn't correct
90 Incorrect 42 ms 131072 KB Output isn't correct
91 Incorrect 72 ms 131072 KB Output isn't correct
92 Incorrect 75 ms 131072 KB Output isn't correct
93 Incorrect 88 ms 131072 KB Output isn't correct
94 Incorrect 75 ms 131072 KB Output isn't correct
95 Incorrect 77 ms 131072 KB Output isn't correct
96 Incorrect 80 ms 131072 KB Output isn't correct
97 Incorrect 71 ms 131072 KB Output isn't correct
98 Incorrect 77 ms 131072 KB Output isn't correct
99 Incorrect 77 ms 131072 KB Output isn't correct
100 Incorrect 72 ms 131072 KB Output isn't correct