# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1114024 |
2024-11-18T06:28:25 Z |
adiyer |
Bomb (IZhO17_bomb) |
C++17 |
|
130 ms |
55876 KB |
// 194.67
#pragma optimize ("g",on)
#pragma GCC optimize("inline")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
#include <bits/stdc++.h>
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);
#define adiyer(); ios_base::sync_with_stdio(0); cin.tie(0);
#define bitcount(n) __builtin_popcountll(n)
#define puts(x) cout << (x ? "YES\n" : "NO\n");
#define ent (i == n ? '\n' : ' ')
#define all(x) x.begin(), x.end()
#define md ((l + r) >> 1)
#define rv(v) ((v << 1) | 1)
#define lv(v) (v << 1)
#define rs(v) rv(v), md + 1, r
#define ls(v) lv(v), l, md
#define len(s) (int) s.size()
#define yes { cout << "YES\n"; return; }
#define no { cout << "NO\n"; return; }
#define skip continue
#define pb push_back
#define S second
#define F first
#define ne !=
// #define int long long
using namespace std;
typedef int ll;
typedef long double ld;
typedef vector < ll > vll;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
const int dx[8] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
const int N = 2.5e3 + 5;
const int K = 1e5 + 3;
const int MAX = 1e6;
const int mod = 998244353;
const long long inf = 2e9;
const ll o = 1;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
ll n, m, w, h;
ll a[N][N], pref[N][N];
char c;
ll get(ll l1, ll r1, ll l2, ll r2){
return pref[l2][r2] - pref[l1 - 1][r2] - pref[l2][r1 - 1] + pref[l1 - 1][r1 - 1];
}
void output(){
cin >> n >> m, w = m, h = n;
for(ll i = 1; i <= n; i++)
for(ll j = 1; j <= m; j++)
cin >> c, a[i][j] = c - '0';
for(ll i = 1; i <= n; i++)
for(ll j = 1; j <= m; j++)
pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + a[i][j];
for(ll i = 1; i <= n; i++){
for(ll j = 1; j <= m; j++){
if(!a[i][j - 1] && a[i][j]){
ll l = j, r = m + 1;
while(r - l > 1){
if(get(i, j, i, md) == md - j + 1) l = md;
else r = md;
}
w = min(w, l - j + 1);
// cout << i << ' ' << j << ' ' << l << '\n';
}
if(!a[i - 1][j] && a[i][j]){
ll l = i, r = n + 1;
while(r - l > 1){
if(get(i, j, md, j) == md - i + 1) l = md;
else r = md;
}
h = min(h, l - i + 1);
// cout << i << ' ' << j << ' ' << l << '\n';
}
}
}
cout << h * w;
}
const bool cases = 0;
signed main(){
// file("disrupt");
adiyer();
int tt = 1;
if(cases) cin >> tt;
for(int i = 1; i <= tt; i++){
// cout << "Case " << i << ":\n";
output();
// slow();
// stress();
}
}
Compilation message
bomb.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
2 | #pragma optimize ("g",on)
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
11 ms |
34912 KB |
Output is correct |
4 |
Correct |
10 ms |
34896 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
2 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
2552 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2552 KB |
Output isn't correct |
13 |
Correct |
1 ms |
2384 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
16 |
Correct |
1 ms |
2384 KB |
Output is correct |
17 |
Correct |
2 ms |
4688 KB |
Output is correct |
18 |
Incorrect |
2 ms |
4688 KB |
Output isn't correct |
19 |
Incorrect |
2 ms |
4944 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
4944 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
4688 KB |
Output isn't correct |
22 |
Incorrect |
2 ms |
4688 KB |
Output isn't correct |
23 |
Incorrect |
2 ms |
5112 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
4688 KB |
Output isn't correct |
25 |
Incorrect |
2 ms |
4992 KB |
Output isn't correct |
26 |
Correct |
2 ms |
4944 KB |
Output is correct |
27 |
Correct |
4 ms |
8016 KB |
Output is correct |
28 |
Incorrect |
4 ms |
8276 KB |
Output isn't correct |
29 |
Incorrect |
7 ms |
8784 KB |
Output isn't correct |
30 |
Incorrect |
6 ms |
9040 KB |
Output isn't correct |
31 |
Incorrect |
4 ms |
8528 KB |
Output isn't correct |
32 |
Incorrect |
5 ms |
8784 KB |
Output isn't correct |
33 |
Incorrect |
6 ms |
11344 KB |
Output isn't correct |
34 |
Incorrect |
3 ms |
8272 KB |
Output isn't correct |
35 |
Incorrect |
6 ms |
11344 KB |
Output isn't correct |
36 |
Correct |
5 ms |
11344 KB |
Output is correct |
37 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
38 |
Correct |
71 ms |
55632 KB |
Output is correct |
39 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
40 |
Incorrect |
15 ms |
20304 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
42 |
Incorrect |
2 ms |
4944 KB |
Output isn't correct |
43 |
Correct |
70 ms |
55512 KB |
Output is correct |
44 |
Incorrect |
6 ms |
11344 KB |
Output isn't correct |
45 |
Incorrect |
71 ms |
55624 KB |
Output isn't correct |
46 |
Correct |
81 ms |
55532 KB |
Output is correct |
47 |
Incorrect |
70 ms |
55624 KB |
Output isn't correct |
48 |
Incorrect |
87 ms |
55632 KB |
Output isn't correct |
49 |
Correct |
73 ms |
55624 KB |
Output is correct |
50 |
Incorrect |
77 ms |
55644 KB |
Output isn't correct |
51 |
Incorrect |
84 ms |
55624 KB |
Output isn't correct |
52 |
Incorrect |
96 ms |
55624 KB |
Output isn't correct |
53 |
Incorrect |
86 ms |
55516 KB |
Output isn't correct |
54 |
Incorrect |
80 ms |
55624 KB |
Output isn't correct |
55 |
Incorrect |
91 ms |
55636 KB |
Output isn't correct |
56 |
Correct |
89 ms |
55512 KB |
Output is correct |
57 |
Incorrect |
83 ms |
55656 KB |
Output isn't correct |
58 |
Incorrect |
94 ms |
55508 KB |
Output isn't correct |
59 |
Incorrect |
88 ms |
55620 KB |
Output isn't correct |
60 |
Correct |
78 ms |
55624 KB |
Output is correct |
61 |
Correct |
86 ms |
55624 KB |
Output is correct |
62 |
Correct |
86 ms |
55624 KB |
Output is correct |
63 |
Correct |
83 ms |
55624 KB |
Output is correct |
64 |
Correct |
84 ms |
55528 KB |
Output is correct |
65 |
Incorrect |
78 ms |
55624 KB |
Output isn't correct |
66 |
Incorrect |
81 ms |
55624 KB |
Output isn't correct |
67 |
Incorrect |
97 ms |
55624 KB |
Output isn't correct |
68 |
Incorrect |
83 ms |
55624 KB |
Output isn't correct |
69 |
Incorrect |
121 ms |
55644 KB |
Output isn't correct |
70 |
Incorrect |
66 ms |
47440 KB |
Output isn't correct |
71 |
Incorrect |
79 ms |
55624 KB |
Output isn't correct |
72 |
Incorrect |
99 ms |
55512 KB |
Output isn't correct |
73 |
Incorrect |
115 ms |
55624 KB |
Output isn't correct |
74 |
Incorrect |
107 ms |
55368 KB |
Output isn't correct |
75 |
Incorrect |
117 ms |
55624 KB |
Output isn't correct |
76 |
Incorrect |
105 ms |
55380 KB |
Output isn't correct |
77 |
Incorrect |
109 ms |
55368 KB |
Output isn't correct |
78 |
Incorrect |
103 ms |
55376 KB |
Output isn't correct |
79 |
Incorrect |
130 ms |
55376 KB |
Output isn't correct |
80 |
Incorrect |
114 ms |
55376 KB |
Output isn't correct |
81 |
Incorrect |
76 ms |
55636 KB |
Output isn't correct |
82 |
Incorrect |
97 ms |
55624 KB |
Output isn't correct |
83 |
Incorrect |
80 ms |
55660 KB |
Output isn't correct |
84 |
Incorrect |
104 ms |
55512 KB |
Output isn't correct |
85 |
Incorrect |
102 ms |
55624 KB |
Output isn't correct |
86 |
Incorrect |
89 ms |
55632 KB |
Output isn't correct |
87 |
Incorrect |
89 ms |
55660 KB |
Output isn't correct |
88 |
Incorrect |
84 ms |
55636 KB |
Output isn't correct |
89 |
Incorrect |
90 ms |
55624 KB |
Output isn't correct |
90 |
Incorrect |
60 ms |
47572 KB |
Output isn't correct |
91 |
Incorrect |
101 ms |
55876 KB |
Output isn't correct |
92 |
Incorrect |
89 ms |
55620 KB |
Output isn't correct |
93 |
Incorrect |
93 ms |
55624 KB |
Output isn't correct |
94 |
Incorrect |
77 ms |
55532 KB |
Output isn't correct |
95 |
Incorrect |
83 ms |
55624 KB |
Output isn't correct |
96 |
Incorrect |
107 ms |
55764 KB |
Output isn't correct |
97 |
Incorrect |
92 ms |
55508 KB |
Output isn't correct |
98 |
Incorrect |
92 ms |
55648 KB |
Output isn't correct |
99 |
Incorrect |
81 ms |
55520 KB |
Output isn't correct |
100 |
Incorrect |
71 ms |
55528 KB |
Output isn't correct |