Submission #833516

# Submission time Handle Problem Language Result Execution time Memory
833516 2023-08-22T06:24:56 Z vjudge1 Bomb (IZhO17_bomb) C++17
24 / 100
50 ms 56256 KB
#include<bits/stdc++.h>
using namespace std;

// // PBDS Template
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//
//template <class T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
//using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;

// Preset
const int maxn = 200000;
const int INF = INT_MAX;
const long long int LINF = LLONG_MAX;
const long long int mod = 1e9 + 7;
const long long int mod2 = 998244353;
//const double e = 2.71828;
const double PI = acos(-1);
const double eps = 1e-10;
#define pb push_back
#define ll long long
#define ull unsigned long long
typedef pair<char,char> pc;
typedef pair<double,double> pd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<pi,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<string,int> psi;
typedef pair<int,string> pis;
typedef pair<char,int> pci;
typedef pair<int,char> pic;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
int dr[4] = {0,1,0,-1}, dc[4] = {1,0,-1,0};


void solve() {
	int n,m;
	cin >> n >> m;
	string s[n+5];
	for (int i=0; i<n; i++) {
		cin >> s[i];
	}
	int pr[m+5][n+5], pc[n+5][m+5];
	int h=INF, w=INF;
	for (int i=0; i<n; i++) {
		pc[i][0] = (int)(s[i][0]-'0');
		for (int j=1; j<m; j++) {
			if (s[i][j]=='1') pc[i][j] = pc[i][j-1] + 1;
			else {
				if (pc[i][j-1]) w = min(w, pc[i][j-1]);
				pc[i][j] = 0;
			}
		}
		if (pc[i][m-1]) w = min(w, pc[i][m-1]);
	}
	if (w==INF) w = 0;
	for (int i=0; i<m; i++) {
		pr[i][0] = (int)(s[0][i]-'0');
		for (int j=1; j<n; j++) {
			if (s[j][i]=='1') pr[i][j] = pr[i][j-1] + 1;
			else {
				if (pr[i][j-1]) h = min(h, pr[i][j-1]);
				pr[i][j] = 0;
			}
		}
		if (pr[i][n-1]) h = min(h, pr[i][n-1]);
	}
	if (h==INF) h = 0;
//	cout << endl;
//	for (int i=0; i<n; i++) {
//		for (int j=0; j<m; j++) cout << pc[i][j] << ' ';
//		cout << endl;
//	}
//	cout << endl;
//	for (int i=0; i<m; i++) {
//		for (int j=0; j<n; j++) cout << pr[i][j] << ' ';
//		cout << endl;
//	}
	ll ans = 1ll*h*w;
	cout << ans << '\n';
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//	precompute();
//	FFT::init_fft();
	int tc=1;
//	cin >> tc;
//	getchar();
//	int idx = 0;
	while (tc--) solve();
 	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 0 ms 212 KB Output isn't correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Incorrect 0 ms 212 KB Output isn't correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Incorrect 0 ms 212 KB Output isn't correct
16 Correct 0 ms 284 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Incorrect 0 ms 340 KB Output isn't correct
19 Incorrect 1 ms 340 KB Output isn't correct
20 Incorrect 0 ms 340 KB Output isn't correct
21 Incorrect 1 ms 340 KB Output isn't correct
22 Incorrect 0 ms 340 KB Output isn't correct
23 Incorrect 0 ms 340 KB Output isn't correct
24 Incorrect 0 ms 340 KB Output isn't correct
25 Incorrect 1 ms 340 KB Output isn't correct
26 Correct 0 ms 340 KB Output is correct
27 Correct 1 ms 980 KB Output is correct
28 Incorrect 1 ms 1236 KB Output isn't correct
29 Incorrect 1 ms 1364 KB Output isn't correct
30 Incorrect 2 ms 2004 KB Output isn't correct
31 Incorrect 2 ms 1620 KB Output isn't correct
32 Incorrect 1 ms 1748 KB Output isn't correct
33 Incorrect 2 ms 2132 KB Output isn't correct
34 Incorrect 1 ms 980 KB Output isn't correct
35 Incorrect 2 ms 2132 KB Output isn't correct
36 Correct 2 ms 2132 KB Output is correct
37 Incorrect 0 ms 212 KB Output isn't correct
38 Correct 46 ms 56148 KB Output is correct
39 Incorrect 0 ms 212 KB Output isn't correct
40 Incorrect 5 ms 7252 KB Output isn't correct
41 Incorrect 0 ms 212 KB Output isn't correct
42 Incorrect 0 ms 340 KB Output isn't correct
43 Correct 46 ms 56144 KB Output is correct
44 Incorrect 2 ms 2132 KB Output isn't correct
45 Incorrect 45 ms 56136 KB Output isn't correct
46 Correct 50 ms 56044 KB Output is correct
47 Incorrect 45 ms 56132 KB Output isn't correct
48 Incorrect 45 ms 56048 KB Output isn't correct
49 Correct 46 ms 56140 KB Output is correct
50 Incorrect 45 ms 56152 KB Output isn't correct
51 Incorrect 46 ms 56012 KB Output isn't correct
52 Incorrect 46 ms 56016 KB Output isn't correct
53 Incorrect 46 ms 56108 KB Output isn't correct
54 Incorrect 50 ms 56256 KB Output isn't correct
55 Incorrect 46 ms 56132 KB Output isn't correct
56 Correct 45 ms 56132 KB Output is correct
57 Incorrect 48 ms 56072 KB Output isn't correct
58 Incorrect 46 ms 56144 KB Output isn't correct
59 Incorrect 45 ms 56088 KB Output isn't correct
60 Correct 45 ms 56148 KB Output is correct
61 Correct 46 ms 56044 KB Output is correct
62 Correct 45 ms 56148 KB Output is correct
63 Correct 47 ms 56012 KB Output is correct
64 Correct 47 ms 56144 KB Output is correct
65 Incorrect 46 ms 56140 KB Output isn't correct
66 Incorrect 46 ms 56164 KB Output isn't correct
67 Incorrect 46 ms 56136 KB Output isn't correct
68 Incorrect 46 ms 56140 KB Output isn't correct
69 Incorrect 45 ms 56144 KB Output isn't correct
70 Incorrect 29 ms 36024 KB Output isn't correct
71 Incorrect 45 ms 56144 KB Output isn't correct
72 Incorrect 47 ms 56148 KB Output isn't correct
73 Incorrect 48 ms 56200 KB Output isn't correct
74 Incorrect 45 ms 56012 KB Output isn't correct
75 Incorrect 47 ms 56144 KB Output isn't correct
76 Incorrect 45 ms 56060 KB Output isn't correct
77 Incorrect 47 ms 56148 KB Output isn't correct
78 Incorrect 45 ms 56064 KB Output isn't correct
79 Incorrect 45 ms 56156 KB Output isn't correct
80 Incorrect 45 ms 56140 KB Output isn't correct
81 Incorrect 46 ms 56136 KB Output isn't correct
82 Incorrect 46 ms 56076 KB Output isn't correct
83 Incorrect 45 ms 56148 KB Output isn't correct
84 Incorrect 44 ms 56144 KB Output isn't correct
85 Incorrect 46 ms 56132 KB Output isn't correct
86 Incorrect 46 ms 56040 KB Output isn't correct
87 Incorrect 46 ms 56076 KB Output isn't correct
88 Incorrect 46 ms 56128 KB Output isn't correct
89 Incorrect 45 ms 56108 KB Output isn't correct
90 Incorrect 28 ms 35968 KB Output isn't correct
91 Incorrect 45 ms 56024 KB Output isn't correct
92 Incorrect 47 ms 56148 KB Output isn't correct
93 Incorrect 46 ms 56112 KB Output isn't correct
94 Incorrect 46 ms 56132 KB Output isn't correct
95 Incorrect 50 ms 56148 KB Output isn't correct
96 Incorrect 49 ms 56040 KB Output isn't correct
97 Incorrect 48 ms 56040 KB Output isn't correct
98 Incorrect 45 ms 56148 KB Output isn't correct
99 Incorrect 45 ms 56108 KB Output isn't correct
100 Incorrect 46 ms 56112 KB Output isn't correct