Submission #333910

# Submission time Handle Problem Language Result Execution time Memory
333910 2020-12-08T02:54:09 Z tengiz05 Bomb (IZhO17_bomb) C++17
24 / 100
271 ms 62828 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);
			}
		}
	}
	if(mx == mod){
		mx = 0;
		my = 0;
	}
//	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 636 KB Output is correct
3 Correct 12 ms 22636 KB Output is correct
4 Correct 12 ms 22636 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 1 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 7 ms 5740 KB Output isn't correct
34 Incorrect 3 ms 2796 KB Output isn't correct
35 Incorrect 6 ms 4076 KB Output isn't correct
36 Correct 44 ms 5996 KB Output is correct
37 Incorrect 1 ms 492 KB Output isn't correct
38 Correct 271 ms 62184 KB Output is correct
39 Incorrect 1 ms 492 KB Output isn't correct
40 Incorrect 34 ms 14188 KB Output isn't correct
41 Incorrect 1 ms 492 KB Output isn't correct
42 Incorrect 1 ms 1388 KB Output isn't correct
43 Correct 209 ms 62828 KB Output is correct
44 Incorrect 8 ms 5996 KB Output isn't correct
45 Incorrect 204 ms 62772 KB Output isn't correct
46 Correct 156 ms 62700 KB Output is correct
47 Incorrect 206 ms 62628 KB Output isn't correct
48 Incorrect 210 ms 62700 KB Output isn't correct
49 Correct 246 ms 62700 KB Output is correct
50 Incorrect 196 ms 62828 KB Output isn't correct
51 Incorrect 196 ms 62700 KB Output isn't correct
52 Incorrect 199 ms 62700 KB Output isn't correct
53 Incorrect 189 ms 62700 KB Output isn't correct
54 Incorrect 171 ms 62700 KB Output isn't correct
55 Incorrect 185 ms 61932 KB Output isn't correct
56 Correct 247 ms 62700 KB Output is correct
57 Incorrect 164 ms 60140 KB Output isn't correct
58 Incorrect 176 ms 62572 KB Output isn't correct
59 Incorrect 165 ms 61292 KB Output isn't correct
60 Correct 193 ms 62700 KB Output is correct
61 Correct 248 ms 62700 KB Output is correct
62 Correct 240 ms 62700 KB Output is correct
63 Correct 238 ms 62700 KB Output is correct
64 Correct 163 ms 62520 KB Output is correct
65 Incorrect 191 ms 62700 KB Output isn't correct
66 Incorrect 188 ms 62572 KB Output isn't correct
67 Incorrect 199 ms 62700 KB Output isn't correct
68 Incorrect 205 ms 62700 KB Output isn't correct
69 Incorrect 165 ms 59756 KB Output isn't correct
70 Incorrect 93 ms 44652 KB Output isn't correct
71 Incorrect 144 ms 58860 KB Output isn't correct
72 Incorrect 152 ms 59628 KB Output isn't correct
73 Incorrect 150 ms 59116 KB Output isn't correct
74 Incorrect 148 ms 60268 KB Output isn't correct
75 Incorrect 157 ms 60908 KB Output isn't correct
76 Incorrect 157 ms 61164 KB Output isn't correct
77 Incorrect 161 ms 61164 KB Output isn't correct
78 Incorrect 154 ms 61804 KB Output isn't correct
79 Incorrect 132 ms 53612 KB Output isn't correct
80 Incorrect 132 ms 54472 KB Output isn't correct
81 Incorrect 133 ms 53740 KB Output isn't correct
82 Incorrect 160 ms 62188 KB Output isn't correct
83 Incorrect 158 ms 62316 KB Output isn't correct
84 Incorrect 129 ms 50668 KB Output isn't correct
85 Incorrect 160 ms 62700 KB Output isn't correct
86 Incorrect 232 ms 62700 KB Output isn't correct
87 Incorrect 159 ms 62700 KB Output isn't correct
88 Incorrect 156 ms 61676 KB Output isn't correct
89 Incorrect 185 ms 62700 KB Output isn't correct
90 Incorrect 101 ms 50412 KB Output isn't correct
91 Incorrect 170 ms 62572 KB Output isn't correct
92 Incorrect 182 ms 62700 KB Output isn't correct
93 Incorrect 225 ms 62828 KB Output isn't correct
94 Incorrect 183 ms 62700 KB Output isn't correct
95 Incorrect 159 ms 62356 KB Output isn't correct
96 Incorrect 157 ms 62188 KB Output isn't correct
97 Incorrect 229 ms 62700 KB Output isn't correct
98 Incorrect 162 ms 62060 KB Output isn't correct
99 Incorrect 181 ms 62580 KB Output isn't correct
100 Incorrect 222 ms 62700 KB Output isn't correct