# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
170170 |
2019-12-24T06:57:36 Z |
dxz05 |
Bomb (IZhO17_bomb) |
C++14 |
|
222 ms |
55948 KB |
#include <bits/stdc++.h>
using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define SZ(x) ((int)x.size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1e9;
const int MOD = 1000000007;
const int N = 2002055;
const int M = 2511;
char a[M][M];
int dpx[M][M], dpy[M][M];
void solve() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> a[i][j];
if (a[i][j] == '1'){
dpx[i][j] = 1;
dpy[i][j] = 1;
}
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (a[i][j] == '0') continue;
if (a[i][j-1] == '1' && j != 1) dpx[i][j] += dpx[i][j-1];
if (a[i-1][j] == '1' && i != 1) dpy[i][j] += dpy[i-1][j];
}
}
for (int i = n; i >= 1; i--){
for (int j = m; j >= 1; j--){
if (a[i][j] == '0') continue;
dpx[i][j] = max(dpx[i][j], dpx[i][j+1]);
dpy[i][j] = max(dpy[i][j], dpy[i+1][j]);
}
}
int A = INF, B = INF;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= m; j++){
//cout << dpx[i][j] << ',' << dpy[i][j] << "\t";
if (a[i][j] == '0') continue;
A = min(A, dpx[i][j]);
B = min(B, dpy[i][j]);
}
//cout << endl;
}
cout << A*B;
}
int main() {
ios_base::sync_with_stdio(false);
#ifdef dxz05
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
#endif
int T = 1;
//cin >> T;
while (T--) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
22 ms |
26616 KB |
Output is correct |
4 |
Correct |
22 ms |
26616 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
13 |
Correct |
2 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
508 KB |
Output is correct |
15 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
16 |
Correct |
2 ms |
632 KB |
Output is correct |
17 |
Correct |
2 ms |
1016 KB |
Output is correct |
18 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
19 |
Incorrect |
2 ms |
1016 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
1016 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
22 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
23 |
Incorrect |
3 ms |
1016 KB |
Output isn't correct |
24 |
Incorrect |
2 ms |
1016 KB |
Output isn't correct |
25 |
Incorrect |
3 ms |
1400 KB |
Output isn't correct |
26 |
Correct |
3 ms |
1528 KB |
Output is correct |
27 |
Correct |
7 ms |
4088 KB |
Output is correct |
28 |
Incorrect |
5 ms |
1528 KB |
Output isn't correct |
29 |
Incorrect |
9 ms |
5240 KB |
Output isn't correct |
30 |
Incorrect |
9 ms |
4216 KB |
Output isn't correct |
31 |
Incorrect |
7 ms |
3064 KB |
Output isn't correct |
32 |
Incorrect |
8 ms |
4096 KB |
Output isn't correct |
33 |
Incorrect |
11 ms |
5240 KB |
Output isn't correct |
34 |
Incorrect |
5 ms |
1784 KB |
Output isn't correct |
35 |
Incorrect |
8 ms |
2040 KB |
Output isn't correct |
36 |
Correct |
12 ms |
6648 KB |
Output is correct |
37 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
38 |
Correct |
216 ms |
55644 KB |
Output is correct |
39 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
40 |
Incorrect |
35 ms |
15608 KB |
Output isn't correct |
41 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
42 |
Incorrect |
3 ms |
1400 KB |
Output isn't correct |
43 |
Correct |
216 ms |
51804 KB |
Output is correct |
44 |
Incorrect |
12 ms |
6008 KB |
Output isn't correct |
45 |
Incorrect |
205 ms |
52984 KB |
Output isn't correct |
46 |
Correct |
211 ms |
55668 KB |
Output is correct |
47 |
Incorrect |
204 ms |
53112 KB |
Output isn't correct |
48 |
Incorrect |
202 ms |
55656 KB |
Output isn't correct |
49 |
Correct |
217 ms |
55948 KB |
Output is correct |
50 |
Incorrect |
207 ms |
55556 KB |
Output isn't correct |
51 |
Incorrect |
205 ms |
55800 KB |
Output isn't correct |
52 |
Incorrect |
203 ms |
55716 KB |
Output isn't correct |
53 |
Incorrect |
202 ms |
54956 KB |
Output isn't correct |
54 |
Incorrect |
184 ms |
42236 KB |
Output isn't correct |
55 |
Incorrect |
187 ms |
40540 KB |
Output isn't correct |
56 |
Correct |
220 ms |
55800 KB |
Output is correct |
57 |
Incorrect |
176 ms |
35576 KB |
Output isn't correct |
58 |
Incorrect |
181 ms |
40568 KB |
Output isn't correct |
59 |
Incorrect |
178 ms |
37496 KB |
Output isn't correct |
60 |
Correct |
194 ms |
47572 KB |
Output is correct |
61 |
Correct |
215 ms |
55588 KB |
Output is correct |
62 |
Correct |
218 ms |
55612 KB |
Output is correct |
63 |
Correct |
215 ms |
55644 KB |
Output is correct |
64 |
Correct |
180 ms |
38512 KB |
Output is correct |
65 |
Incorrect |
201 ms |
54520 KB |
Output isn't correct |
66 |
Incorrect |
198 ms |
51400 KB |
Output isn't correct |
67 |
Incorrect |
204 ms |
55584 KB |
Output isn't correct |
68 |
Incorrect |
210 ms |
55672 KB |
Output isn't correct |
69 |
Incorrect |
176 ms |
35208 KB |
Output isn't correct |
70 |
Incorrect |
105 ms |
15324 KB |
Output isn't correct |
71 |
Incorrect |
168 ms |
28260 KB |
Output isn't correct |
72 |
Incorrect |
174 ms |
33628 KB |
Output isn't correct |
73 |
Incorrect |
176 ms |
34172 KB |
Output isn't correct |
74 |
Incorrect |
177 ms |
35612 KB |
Output isn't correct |
75 |
Incorrect |
180 ms |
37248 KB |
Output isn't correct |
76 |
Incorrect |
179 ms |
38520 KB |
Output isn't correct |
77 |
Incorrect |
181 ms |
39108 KB |
Output isn't correct |
78 |
Incorrect |
181 ms |
39352 KB |
Output isn't correct |
79 |
Incorrect |
150 ms |
11768 KB |
Output isn't correct |
80 |
Incorrect |
153 ms |
13084 KB |
Output isn't correct |
81 |
Incorrect |
150 ms |
13404 KB |
Output isn't correct |
82 |
Incorrect |
200 ms |
41852 KB |
Output isn't correct |
83 |
Incorrect |
184 ms |
41956 KB |
Output isn't correct |
84 |
Incorrect |
145 ms |
7032 KB |
Output isn't correct |
85 |
Incorrect |
182 ms |
40956 KB |
Output isn't correct |
86 |
Incorrect |
211 ms |
54548 KB |
Output isn't correct |
87 |
Incorrect |
179 ms |
39832 KB |
Output isn't correct |
88 |
Incorrect |
198 ms |
40824 KB |
Output isn't correct |
89 |
Incorrect |
194 ms |
49528 KB |
Output isn't correct |
90 |
Incorrect |
119 ms |
29688 KB |
Output isn't correct |
91 |
Incorrect |
187 ms |
44688 KB |
Output isn't correct |
92 |
Incorrect |
192 ms |
46420 KB |
Output isn't correct |
93 |
Incorrect |
210 ms |
53624 KB |
Output isn't correct |
94 |
Incorrect |
196 ms |
48316 KB |
Output isn't correct |
95 |
Incorrect |
192 ms |
41976 KB |
Output isn't correct |
96 |
Incorrect |
184 ms |
41720 KB |
Output isn't correct |
97 |
Incorrect |
222 ms |
54464 KB |
Output isn't correct |
98 |
Incorrect |
183 ms |
41464 KB |
Output isn't correct |
99 |
Incorrect |
200 ms |
47964 KB |
Output isn't correct |
100 |
Incorrect |
209 ms |
53260 KB |
Output isn't correct |