Submission #556093

# Submission time Handle Problem Language Result Execution time Memory
556093 2022-05-02T10:51:22 Z ngpin04 Bomb (IZhO17_bomb) C++14
24 / 100
88 ms 31240 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define TASK ""
#define ALL(x) (x).begin(), (x).end() 
using namespace std;
template <typename T1, typename T2> bool mini(T1 &a, T2 b) {
	if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maxi(T1 &a, T2 b) {
	if (a < b) {a = b; return true;} return false;
}
const int N = 2505;
const int oo = 1e9;
const long long ooo = 1e18;
const int mod = 1e9 + 7; // 998244353;
const long double pi = acos(-1);

int a[N][N];
int n,m;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	#ifdef ONLINE_JUDGE
	// freopen(TASK".inp","r",stdin);
	// freopen(TASK".out","w",stdout);
	#endif
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		string str; cin >> str;
		for (int j = 1; j <= m; j++)
			a[i][j] = str[j - 1] - '0';
	}

	int r = oo, c = oo;

	for (int i = 1; i <= n; i++) {
		int cnt = 0;
		for (int j = 1; j <= m; j++) {
			if (a[i][j] == 0) {
				if (cnt > 0)
					mini(c, cnt);
				cnt = 0;
			} else
				cnt++;
		}
		if (cnt > 0)
			mini(c, cnt);
	}

	for (int j = 1; j <= m; j++) {
		int cnt = 0;
		for (int i = 1; i <= n; i++) {
			if (a[i][j] == 0) {
				if (cnt > 0)
					mini(r, cnt);
				cnt = 0;
			} else
			 	cnt++;
		}

		if (cnt > 0)
			mini(r, cnt);
	}

	cout << r * c;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 4 ms 10324 KB Output is correct
4 Correct 4 ms 10324 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 1 ms 340 KB Output isn't correct
9 Incorrect 1 ms 340 KB Output isn't correct
10 Incorrect 0 ms 340 KB Output isn't correct
11 Incorrect 0 ms 340 KB Output isn't correct
12 Incorrect 0 ms 340 KB Output isn't correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 368 KB Output is correct
15 Incorrect 0 ms 332 KB Output isn't correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 596 KB Output is correct
18 Incorrect 1 ms 596 KB Output isn't correct
19 Incorrect 1 ms 724 KB Output isn't correct
20 Incorrect 1 ms 724 KB Output isn't correct
21 Incorrect 1 ms 468 KB Output isn't correct
22 Incorrect 1 ms 588 KB Output isn't correct
23 Incorrect 1 ms 724 KB Output isn't correct
24 Incorrect 1 ms 596 KB Output isn't correct
25 Incorrect 1 ms 724 KB Output isn't correct
26 Correct 1 ms 724 KB Output is correct
27 Correct 1 ms 1856 KB Output is correct
28 Incorrect 2 ms 2004 KB Output isn't correct
29 Incorrect 2 ms 2516 KB Output isn't correct
30 Incorrect 2 ms 2988 KB Output isn't correct
31 Incorrect 2 ms 2340 KB Output isn't correct
32 Incorrect 2 ms 2644 KB Output isn't correct
33 Incorrect 2 ms 3028 KB Output isn't correct
34 Incorrect 2 ms 2132 KB Output isn't correct
35 Incorrect 2 ms 3036 KB Output isn't correct
36 Correct 2 ms 3036 KB Output is correct
37 Incorrect 0 ms 340 KB Output isn't correct
38 Correct 71 ms 30924 KB Output is correct
39 Incorrect 1 ms 340 KB Output isn't correct
40 Incorrect 6 ms 7636 KB Output isn't correct
41 Incorrect 1 ms 416 KB Output isn't correct
42 Incorrect 1 ms 720 KB Output isn't correct
43 Correct 77 ms 30984 KB Output is correct
44 Incorrect 2 ms 3028 KB Output isn't correct
45 Incorrect 68 ms 30924 KB Output isn't correct
46 Correct 72 ms 30916 KB Output is correct
47 Incorrect 75 ms 30980 KB Output isn't correct
48 Incorrect 72 ms 30916 KB Output isn't correct
49 Correct 69 ms 30888 KB Output is correct
50 Incorrect 72 ms 30964 KB Output isn't correct
51 Incorrect 69 ms 30888 KB Output isn't correct
52 Incorrect 75 ms 30988 KB Output isn't correct
53 Incorrect 68 ms 30988 KB Output isn't correct
54 Incorrect 71 ms 30924 KB Output isn't correct
55 Incorrect 83 ms 30988 KB Output isn't correct
56 Correct 77 ms 30988 KB Output is correct
57 Incorrect 70 ms 30980 KB Output isn't correct
58 Incorrect 69 ms 30880 KB Output isn't correct
59 Incorrect 67 ms 30912 KB Output isn't correct
60 Correct 71 ms 30996 KB Output is correct
61 Correct 80 ms 30984 KB Output is correct
62 Correct 77 ms 30868 KB Output is correct
63 Correct 82 ms 30924 KB Output is correct
64 Correct 86 ms 30912 KB Output is correct
65 Incorrect 86 ms 31240 KB Output isn't correct
66 Incorrect 81 ms 30888 KB Output isn't correct
67 Incorrect 80 ms 30924 KB Output isn't correct
68 Incorrect 85 ms 30992 KB Output isn't correct
69 Incorrect 83 ms 31180 KB Output isn't correct
70 Incorrect 51 ms 23880 KB Output isn't correct
71 Incorrect 81 ms 30876 KB Output isn't correct
72 Incorrect 81 ms 30988 KB Output isn't correct
73 Incorrect 83 ms 30996 KB Output isn't correct
74 Incorrect 88 ms 30860 KB Output isn't correct
75 Incorrect 85 ms 30928 KB Output isn't correct
76 Incorrect 83 ms 30960 KB Output isn't correct
77 Incorrect 85 ms 30872 KB Output isn't correct
78 Incorrect 85 ms 30876 KB Output isn't correct
79 Incorrect 87 ms 30980 KB Output isn't correct
80 Incorrect 82 ms 30992 KB Output isn't correct
81 Incorrect 85 ms 30988 KB Output isn't correct
82 Incorrect 87 ms 31072 KB Output isn't correct
83 Incorrect 78 ms 31092 KB Output isn't correct
84 Incorrect 82 ms 30900 KB Output isn't correct
85 Incorrect 84 ms 30984 KB Output isn't correct
86 Incorrect 78 ms 31084 KB Output isn't correct
87 Incorrect 87 ms 30940 KB Output isn't correct
88 Incorrect 84 ms 30924 KB Output isn't correct
89 Incorrect 82 ms 30984 KB Output isn't correct
90 Incorrect 56 ms 23884 KB Output isn't correct
91 Incorrect 78 ms 30872 KB Output isn't correct
92 Incorrect 82 ms 30988 KB Output isn't correct
93 Incorrect 81 ms 30992 KB Output isn't correct
94 Incorrect 84 ms 30920 KB Output isn't correct
95 Incorrect 81 ms 31052 KB Output isn't correct
96 Incorrect 86 ms 31052 KB Output isn't correct
97 Incorrect 79 ms 30988 KB Output isn't correct
98 Incorrect 81 ms 30900 KB Output isn't correct
99 Incorrect 81 ms 30928 KB Output isn't correct
100 Incorrect 83 ms 31096 KB Output isn't correct