Submission #58795

# Submission time Handle Problem Language Result Execution time Memory
58795 2018-07-19T13:12:58 Z Benq Bomb (IZhO17_bomb) C++14
21 / 100
189 ms 132096 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N,M;
char g[2500][2500];

int solve() {
    int ans = MOD;
    F0R(i,N) {
        int cur = 0;
        F0R(j,M) {
            if (g[i][j] == '1') cur ++;
            else {
                if (cur) ans = min(ans,cur);
                cur = 0;
            }
        }
        if (cur) ans = min(ans,cur);
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    F0R(i,N) F0R(j,M) cin >> g[i][j];
    int x = solve();
    F0R(i,2500) F0R(j,i) swap(g[i][j],g[j][i]);
    swap(N,M);
    cout << x*solve();
}

/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( ) 
* special cases (n=1?)
* overflow (ll vs int?)
* array bounds
*/
# Verdict Execution time Memory Grader output
1 Correct 22 ms 6520 KB Output is correct
2 Correct 21 ms 6640 KB Output is correct
3 Correct 19 ms 6640 KB Output is correct
4 Correct 19 ms 6640 KB Output is correct
5 Correct 24 ms 6812 KB Output is correct
6 Correct 27 ms 6812 KB Output is correct
7 Correct 21 ms 6812 KB Output is correct
8 Incorrect 23 ms 6812 KB Output isn't correct
9 Incorrect 21 ms 6812 KB Output isn't correct
10 Incorrect 27 ms 6812 KB Output isn't correct
11 Incorrect 21 ms 6812 KB Output isn't correct
12 Incorrect 21 ms 6840 KB Output isn't correct
13 Correct 28 ms 6840 KB Output is correct
14 Correct 23 ms 6840 KB Output is correct
15 Incorrect 23 ms 6840 KB Output isn't correct
16 Correct 22 ms 6900 KB Output is correct
17 Correct 21 ms 6908 KB Output is correct
18 Incorrect 23 ms 6932 KB Output isn't correct
19 Incorrect 23 ms 6980 KB Output isn't correct
20 Incorrect 23 ms 6980 KB Output isn't correct
21 Incorrect 30 ms 7012 KB Output isn't correct
22 Incorrect 21 ms 7012 KB Output isn't correct
23 Incorrect 27 ms 7012 KB Output isn't correct
24 Incorrect 22 ms 7012 KB Output isn't correct
25 Incorrect 23 ms 7012 KB Output isn't correct
26 Correct 26 ms 7012 KB Output is correct
27 Correct 24 ms 7236 KB Output is correct
28 Incorrect 24 ms 7236 KB Output isn't correct
29 Incorrect 26 ms 7300 KB Output isn't correct
30 Incorrect 26 ms 7572 KB Output isn't correct
31 Incorrect 25 ms 7736 KB Output isn't correct
32 Incorrect 27 ms 7888 KB Output isn't correct
33 Incorrect 26 ms 8044 KB Output isn't correct
34 Incorrect 23 ms 8168 KB Output isn't correct
35 Incorrect 26 ms 8452 KB Output isn't correct
36 Correct 25 ms 8524 KB Output is correct
37 Incorrect 22 ms 8524 KB Output isn't correct
38 Correct 145 ms 14788 KB Output is correct
39 Incorrect 23 ms 14788 KB Output isn't correct
40 Incorrect 34 ms 15356 KB Output isn't correct
41 Incorrect 22 ms 15356 KB Output isn't correct
42 Incorrect 22 ms 15356 KB Output isn't correct
43 Correct 176 ms 21504 KB Output is correct
44 Incorrect 28 ms 21780 KB Output isn't correct
45 Incorrect 119 ms 27832 KB Output isn't correct
46 Correct 134 ms 34092 KB Output is correct
47 Incorrect 134 ms 40056 KB Output isn't correct
48 Incorrect 137 ms 46216 KB Output isn't correct
49 Correct 114 ms 52344 KB Output is correct
50 Incorrect 114 ms 58504 KB Output isn't correct
51 Incorrect 137 ms 64660 KB Output isn't correct
52 Incorrect 112 ms 70840 KB Output isn't correct
53 Incorrect 108 ms 76968 KB Output isn't correct
54 Incorrect 130 ms 82988 KB Output isn't correct
55 Incorrect 113 ms 89188 KB Output isn't correct
56 Correct 115 ms 95224 KB Output is correct
57 Incorrect 123 ms 101388 KB Output isn't correct
58 Incorrect 130 ms 107548 KB Output isn't correct
59 Incorrect 132 ms 113708 KB Output isn't correct
60 Correct 160 ms 119864 KB Output is correct
61 Correct 134 ms 125844 KB Output is correct
62 Runtime error 112 ms 132076 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
63 Runtime error 108 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
64 Runtime error 109 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
65 Runtime error 138 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
66 Runtime error 159 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
67 Runtime error 113 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
68 Runtime error 118 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
69 Runtime error 138 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
70 Runtime error 97 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
71 Runtime error 137 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
72 Runtime error 142 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
73 Runtime error 140 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
74 Runtime error 179 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
75 Runtime error 146 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
76 Runtime error 127 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
77 Runtime error 111 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
78 Runtime error 134 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
79 Runtime error 135 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
80 Runtime error 165 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
81 Runtime error 147 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
82 Runtime error 126 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
83 Runtime error 189 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
84 Runtime error 133 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
85 Runtime error 113 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
86 Runtime error 135 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
87 Runtime error 134 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
88 Runtime error 130 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
89 Runtime error 135 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
90 Runtime error 89 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
91 Runtime error 107 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
92 Runtime error 127 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
93 Runtime error 116 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
94 Runtime error 109 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
95 Runtime error 114 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
96 Runtime error 117 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
97 Runtime error 123 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
98 Runtime error 108 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
99 Runtime error 126 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
100 Runtime error 128 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.