# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
833693 |
2023-08-22T07:58:23 Z |
vjudge1 |
Bomb (IZhO17_bomb) |
C++17 |
|
66 ms |
56192 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=n, w=m;
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]);
}
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]);
}
// 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;
// }
int ans = 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 |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 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 |
1 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
12 |
Incorrect |
1 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 |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
19 |
Incorrect |
0 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 |
1 ms |
340 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
24 |
Incorrect |
3 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 |
1 ms |
2004 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
1620 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
1620 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 |
48 ms |
56136 KB |
Output is correct |
39 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
40 |
Incorrect |
6 ms |
7252 KB |
Output isn't correct |
41 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
43 |
Correct |
47 ms |
56140 KB |
Output is correct |
44 |
Incorrect |
2 ms |
2132 KB |
Output isn't correct |
45 |
Incorrect |
56 ms |
56148 KB |
Output isn't correct |
46 |
Correct |
47 ms |
56148 KB |
Output is correct |
47 |
Incorrect |
49 ms |
56012 KB |
Output isn't correct |
48 |
Incorrect |
48 ms |
56108 KB |
Output isn't correct |
49 |
Correct |
50 ms |
56012 KB |
Output is correct |
50 |
Incorrect |
53 ms |
56144 KB |
Output isn't correct |
51 |
Incorrect |
49 ms |
56128 KB |
Output isn't correct |
52 |
Incorrect |
51 ms |
56140 KB |
Output isn't correct |
53 |
Incorrect |
48 ms |
56144 KB |
Output isn't correct |
54 |
Incorrect |
66 ms |
56140 KB |
Output isn't correct |
55 |
Incorrect |
47 ms |
56192 KB |
Output isn't correct |
56 |
Correct |
47 ms |
56140 KB |
Output is correct |
57 |
Incorrect |
59 ms |
56012 KB |
Output isn't correct |
58 |
Incorrect |
46 ms |
56108 KB |
Output isn't correct |
59 |
Incorrect |
52 ms |
56140 KB |
Output isn't correct |
60 |
Correct |
46 ms |
56144 KB |
Output is correct |
61 |
Correct |
50 ms |
56148 KB |
Output is correct |
62 |
Correct |
54 ms |
56024 KB |
Output is correct |
63 |
Correct |
51 ms |
56012 KB |
Output is correct |
64 |
Correct |
49 ms |
56120 KB |
Output is correct |
65 |
Incorrect |
57 ms |
56028 KB |
Output isn't correct |
66 |
Incorrect |
49 ms |
56032 KB |
Output isn't correct |
67 |
Incorrect |
53 ms |
56136 KB |
Output isn't correct |
68 |
Incorrect |
49 ms |
56148 KB |
Output isn't correct |
69 |
Incorrect |
47 ms |
56060 KB |
Output isn't correct |
70 |
Incorrect |
30 ms |
36052 KB |
Output isn't correct |
71 |
Incorrect |
47 ms |
56132 KB |
Output isn't correct |
72 |
Incorrect |
49 ms |
56148 KB |
Output isn't correct |
73 |
Incorrect |
48 ms |
56096 KB |
Output isn't correct |
74 |
Incorrect |
46 ms |
56084 KB |
Output isn't correct |
75 |
Incorrect |
46 ms |
56148 KB |
Output isn't correct |
76 |
Incorrect |
46 ms |
56148 KB |
Output isn't correct |
77 |
Incorrect |
46 ms |
56148 KB |
Output isn't correct |
78 |
Incorrect |
47 ms |
56148 KB |
Output isn't correct |
79 |
Incorrect |
45 ms |
56140 KB |
Output isn't correct |
80 |
Incorrect |
47 ms |
56148 KB |
Output isn't correct |
81 |
Incorrect |
47 ms |
56012 KB |
Output isn't correct |
82 |
Incorrect |
48 ms |
56032 KB |
Output isn't correct |
83 |
Incorrect |
47 ms |
56012 KB |
Output isn't correct |
84 |
Incorrect |
49 ms |
56148 KB |
Output isn't correct |
85 |
Incorrect |
48 ms |
56148 KB |
Output isn't correct |
86 |
Incorrect |
54 ms |
56140 KB |
Output isn't correct |
87 |
Incorrect |
47 ms |
56016 KB |
Output isn't correct |
88 |
Incorrect |
49 ms |
56148 KB |
Output isn't correct |
89 |
Incorrect |
50 ms |
56012 KB |
Output isn't correct |
90 |
Incorrect |
37 ms |
36160 KB |
Output isn't correct |
91 |
Incorrect |
48 ms |
56148 KB |
Output isn't correct |
92 |
Incorrect |
48 ms |
56148 KB |
Output isn't correct |
93 |
Incorrect |
50 ms |
56148 KB |
Output isn't correct |
94 |
Incorrect |
50 ms |
56148 KB |
Output isn't correct |
95 |
Incorrect |
50 ms |
56140 KB |
Output isn't correct |
96 |
Incorrect |
47 ms |
56140 KB |
Output isn't correct |
97 |
Incorrect |
49 ms |
56012 KB |
Output isn't correct |
98 |
Incorrect |
49 ms |
56148 KB |
Output isn't correct |
99 |
Incorrect |
48 ms |
56140 KB |
Output isn't correct |
100 |
Incorrect |
53 ms |
56148 KB |
Output isn't correct |