답안 #333907

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333907 2020-12-08T02:49:31 Z tengiz05 Bomb (IZhO17_bomb) C++17
24 / 100
251 ms 67948 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);
			}
		}
	}
//	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;
}


# 결과 실행 시간 메모리 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 13 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 0 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 3692 KB Output is correct
28 Incorrect 4 ms 2668 KB Output isn't correct
29 Incorrect 6 ms 4844 KB Output isn't correct
30 Incorrect 6 ms 5100 KB Output isn't correct
31 Incorrect 76 ms 3948 KB Output isn't correct
32 Incorrect 41 ms 4844 KB Output isn't correct
33 Incorrect 7 ms 5740 KB Output isn't correct
34 Incorrect 39 ms 2796 KB Output isn't correct
35 Incorrect 6 ms 4076 KB Output isn't correct
36 Correct 8 ms 6124 KB Output is correct
37 Incorrect 1 ms 492 KB Output isn't correct
38 Correct 243 ms 63084 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 492 KB Output isn't correct
42 Incorrect 1 ms 1388 KB Output isn't correct
43 Correct 208 ms 63340 KB Output is correct
44 Incorrect 8 ms 5996 KB Output isn't correct
45 Incorrect 203 ms 65188 KB Output isn't correct
46 Correct 156 ms 65516 KB Output is correct
47 Incorrect 206 ms 65516 KB Output isn't correct
48 Incorrect 196 ms 65516 KB Output isn't correct
49 Correct 242 ms 65900 KB Output is correct
50 Incorrect 197 ms 66284 KB Output isn't correct
51 Incorrect 197 ms 66464 KB Output isn't correct
52 Incorrect 193 ms 66412 KB Output isn't correct
53 Incorrect 195 ms 67564 KB Output isn't correct
54 Incorrect 171 ms 67692 KB Output isn't correct
55 Incorrect 166 ms 67032 KB Output isn't correct
56 Correct 251 ms 67948 KB Output is correct
57 Incorrect 164 ms 65132 KB Output isn't correct
58 Incorrect 165 ms 67692 KB Output isn't correct
59 Incorrect 165 ms 66284 KB Output isn't correct
60 Correct 188 ms 67692 KB Output is correct
61 Correct 244 ms 67692 KB Output is correct
62 Correct 230 ms 67792 KB Output is correct
63 Correct 238 ms 67692 KB Output is correct
64 Correct 163 ms 67692 KB Output is correct
65 Incorrect 190 ms 67820 KB Output isn't correct
66 Incorrect 190 ms 67692 KB Output isn't correct
67 Incorrect 200 ms 67692 KB Output isn't correct
68 Incorrect 207 ms 67708 KB Output isn't correct
69 Incorrect 164 ms 64748 KB Output isn't correct
70 Incorrect 96 ms 47468 KB Output isn't correct
71 Incorrect 148 ms 63212 KB Output isn't correct
72 Incorrect 150 ms 64620 KB Output isn't correct
73 Incorrect 149 ms 64236 KB Output isn't correct
74 Incorrect 149 ms 65388 KB Output isn't correct
75 Incorrect 156 ms 65772 KB Output isn't correct
76 Incorrect 164 ms 66284 KB Output isn't correct
77 Incorrect 157 ms 66156 KB Output isn't correct
78 Incorrect 156 ms 66540 KB Output isn't correct
79 Incorrect 136 ms 58732 KB Output isn't correct
80 Incorrect 133 ms 59600 KB Output isn't correct
81 Incorrect 135 ms 58860 KB Output isn't correct
82 Incorrect 163 ms 66924 KB Output isn't correct
83 Incorrect 160 ms 67564 KB Output isn't correct
84 Incorrect 130 ms 55916 KB Output isn't correct
85 Incorrect 160 ms 67444 KB Output isn't correct
86 Incorrect 234 ms 67848 KB Output isn't correct
87 Incorrect 162 ms 67692 KB Output isn't correct
88 Incorrect 158 ms 66796 KB Output isn't correct
89 Incorrect 190 ms 67692 KB Output isn't correct
90 Incorrect 101 ms 53228 KB Output isn't correct
91 Incorrect 169 ms 67052 KB Output isn't correct
92 Incorrect 190 ms 67436 KB Output isn't correct
93 Incorrect 234 ms 67916 KB Output isn't correct
94 Incorrect 186 ms 67692 KB Output isn't correct
95 Incorrect 157 ms 67436 KB Output isn't correct
96 Incorrect 164 ms 67308 KB Output isn't correct
97 Incorrect 231 ms 67724 KB Output isn't correct
98 Incorrect 162 ms 67052 KB Output isn't correct
99 Incorrect 183 ms 67828 KB Output isn't correct
100 Incorrect 227 ms 67692 KB Output isn't correct