# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
333909 |
2020-12-08T02:51:47 Z |
tengiz05 |
Bomb (IZhO17_bomb) |
C++17 |
|
245 ms |
62572 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define PI acos(-1)
#define ld long double
const int mod = 1e9+7, N = 2505;
int msb(int val){return sizeof(int)*8-__builtin_clzll(val);}
int a[N][N], n, m, k;
bool usedup[N][N], usedr[N][N];
void solve(int test_case){
int i, j;
cin >> n >> m;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
char c;
cin >> c;
a[i][j] = (c-'0');
}
}
int mx=mod, my=mod;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
if(a[i][j] == 1){
if(usedup[i][j])continue;
int t = j;
int tmp = 0;
while(t <= m && a[i][t] == 1){
tmp++;
usedup[i][t] = true;
t++;
}mx = min(mx, tmp);
}
}
}
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
if(a[i][j] == 1){
if(usedr[i][j])continue;
int t = i;
int tmp = 0;
while(t <= n && a[t][j] == 1){
tmp++;
usedr[t][j] = true;
t++;
}my = min(my, tmp);
}
}
}
assert(mx != mod && my != mod);
// cout << mx << ' ' << my << '\n';
cout << mx*my << '\n';
return;
}
signed main(){
FASTIO;
#define MULTITEST 0
#if MULTITEST
int ___T;
cin >> ___T;
for(int T_CASE = 1; T_CASE <= ___T; T_CASE++)
solve(T_CASE);
#else
solve(1);
#endif
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
13 ms |
22636 KB |
Output is correct |
4 |
Correct |
12 ms |
22764 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
13 |
Correct |
1 ms |
492 KB |
Output is correct |
14 |
Correct |
1 ms |
492 KB |
Output is correct |
15 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
16 |
Correct |
1 ms |
492 KB |
Output is correct |
17 |
Correct |
1 ms |
1004 KB |
Output is correct |
18 |
Incorrect |
2 ms |
876 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
1004 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
1004 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
620 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
876 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
1132 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
1004 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
1260 KB |
Output isn't correct |
26 |
Correct |
1 ms |
1388 KB |
Output is correct |
27 |
Correct |
4 ms |
3564 KB |
Output is correct |
28 |
Incorrect |
4 ms |
2668 KB |
Output isn't correct |
29 |
Incorrect |
5 ms |
4844 KB |
Output isn't correct |
30 |
Incorrect |
7 ms |
5100 KB |
Output isn't correct |
31 |
Incorrect |
5 ms |
3948 KB |
Output isn't correct |
32 |
Incorrect |
6 ms |
4844 KB |
Output isn't correct |
33 |
Incorrect |
79 ms |
5740 KB |
Output isn't correct |
34 |
Incorrect |
39 ms |
2796 KB |
Output isn't correct |
35 |
Incorrect |
42 ms |
4076 KB |
Output isn't correct |
36 |
Correct |
9 ms |
6016 KB |
Output is correct |
37 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
38 |
Correct |
241 ms |
62316 KB |
Output is correct |
39 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
40 |
Incorrect |
28 ms |
14188 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
1408 KB |
Output isn't correct |
43 |
Correct |
220 ms |
62444 KB |
Output is correct |
44 |
Incorrect |
8 ms |
5996 KB |
Output isn't correct |
45 |
Incorrect |
201 ms |
62444 KB |
Output isn't correct |
46 |
Correct |
161 ms |
62444 KB |
Output is correct |
47 |
Incorrect |
204 ms |
62444 KB |
Output isn't correct |
48 |
Incorrect |
191 ms |
62444 KB |
Output isn't correct |
49 |
Correct |
239 ms |
62572 KB |
Output is correct |
50 |
Incorrect |
197 ms |
62444 KB |
Output isn't correct |
51 |
Incorrect |
195 ms |
62444 KB |
Output isn't correct |
52 |
Incorrect |
197 ms |
62484 KB |
Output isn't correct |
53 |
Incorrect |
192 ms |
62572 KB |
Output isn't correct |
54 |
Incorrect |
167 ms |
62316 KB |
Output isn't correct |
55 |
Incorrect |
167 ms |
61784 KB |
Output isn't correct |
56 |
Correct |
245 ms |
62448 KB |
Output is correct |
57 |
Incorrect |
165 ms |
59884 KB |
Output isn't correct |
58 |
Incorrect |
169 ms |
62316 KB |
Output isn't correct |
59 |
Incorrect |
166 ms |
61036 KB |
Output isn't correct |
60 |
Correct |
193 ms |
62444 KB |
Output is correct |
61 |
Correct |
241 ms |
62444 KB |
Output is correct |
62 |
Correct |
228 ms |
62572 KB |
Output is correct |
63 |
Correct |
239 ms |
62448 KB |
Output is correct |
64 |
Correct |
170 ms |
62316 KB |
Output is correct |
65 |
Incorrect |
190 ms |
62572 KB |
Output isn't correct |
66 |
Incorrect |
189 ms |
62188 KB |
Output isn't correct |
67 |
Incorrect |
197 ms |
62572 KB |
Output isn't correct |
68 |
Incorrect |
203 ms |
62444 KB |
Output isn't correct |
69 |
Incorrect |
164 ms |
59500 KB |
Output isn't correct |
70 |
Incorrect |
94 ms |
44396 KB |
Output isn't correct |
71 |
Incorrect |
146 ms |
58604 KB |
Output isn't correct |
72 |
Incorrect |
149 ms |
59244 KB |
Output isn't correct |
73 |
Incorrect |
153 ms |
58604 KB |
Output isn't correct |
74 |
Incorrect |
151 ms |
60140 KB |
Output isn't correct |
75 |
Incorrect |
161 ms |
60676 KB |
Output isn't correct |
76 |
Incorrect |
155 ms |
61000 KB |
Output isn't correct |
77 |
Incorrect |
161 ms |
60908 KB |
Output isn't correct |
78 |
Incorrect |
156 ms |
61164 KB |
Output isn't correct |
79 |
Incorrect |
138 ms |
53276 KB |
Output isn't correct |
80 |
Incorrect |
134 ms |
54124 KB |
Output isn't correct |
81 |
Incorrect |
136 ms |
53612 KB |
Output isn't correct |
82 |
Incorrect |
160 ms |
61932 KB |
Output isn't correct |
83 |
Incorrect |
162 ms |
62060 KB |
Output isn't correct |
84 |
Incorrect |
132 ms |
50540 KB |
Output isn't correct |
85 |
Incorrect |
163 ms |
62444 KB |
Output isn't correct |
86 |
Incorrect |
231 ms |
62572 KB |
Output isn't correct |
87 |
Incorrect |
160 ms |
62444 KB |
Output isn't correct |
88 |
Incorrect |
161 ms |
61420 KB |
Output isn't correct |
89 |
Incorrect |
186 ms |
62572 KB |
Output isn't correct |
90 |
Incorrect |
105 ms |
50156 KB |
Output isn't correct |
91 |
Incorrect |
172 ms |
62316 KB |
Output isn't correct |
92 |
Incorrect |
185 ms |
62568 KB |
Output isn't correct |
93 |
Incorrect |
233 ms |
62572 KB |
Output isn't correct |
94 |
Incorrect |
186 ms |
62444 KB |
Output isn't correct |
95 |
Incorrect |
160 ms |
62060 KB |
Output isn't correct |
96 |
Incorrect |
162 ms |
61932 KB |
Output isn't correct |
97 |
Incorrect |
232 ms |
62444 KB |
Output isn't correct |
98 |
Incorrect |
180 ms |
61804 KB |
Output isn't correct |
99 |
Incorrect |
185 ms |
62444 KB |
Output isn't correct |
100 |
Incorrect |
226 ms |
62444 KB |
Output isn't correct |