#pragma once
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
#define PB push_back
#define PF push_front
#define PPB pop_back
#define PPF pop_front
#define X first
#define Y second
#define MP make_pair
#define all(x) (x).begin(), (x).end()
const int mod = 1e9 + 7; //998244353;
const int inf = (1 << 30) - 1;
const ll INF = (1ll << 62) - 1;
const int logo = 17;
const int MAXN = 1e5 + 7;
const int off = 1 << logo;
const int trsz = off << 1;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
struct tour{
int seg[trsz];
void update(int x, int vl){
x += off;
seg[x] = vl;
for(x /= 2; x; x /= 2) seg[x] = max(seg[x * 2], seg[x * 2 + 1]);
}
int query(int l, int r){
int ret = 0;
for(l += off, r += off; l < r; l >>= 1, r >>= 1){
if(l & 1) ret = max(ret, seg[l++]);
if(r & 1) ret = max(ret, seg[--r]);
}
return ret;
}
int spusti(int x, int vl, bool fl){
if(x >= off) return x - off;
int pr = x * 2;
if(fl) pr = x * 2 + 1;
if(seg[pr] >= vl) return spusti(pr, vl, fl);
return spusti(pr ^ 1, vl, fl);
}
int nadi(int l, int r, int vl, int fl){
vi lef, rig;
for(l += off, r += off; l < r; l >>= 1, r >>= 1){
if(l & 1) lef.PB(l++);
if(r & 1) rig.PB(--r);
}
while(rig.size()) lef.PB(rig.back()), rig.PPB();
int ans = 0;
if(fl == 0){
for(auto &x : lef){
if(ans == 0 and seg[x] >= vl) ans = spusti(x, vl, 0);
}
}else{
for(auto it = lef.rbegin(); it != lef.rend(); it++){
if(ans == 0 and seg[*it] >= vl) ans = spusti(*it, vl, 1);
}
}
return ans;
}
}t;
struct tdelta{
struct node{
int v1, v2, ret1, ret2;
node(){
v1 = inf, v2 = -inf, ret1 = 0, ret2 = 0;
}
};
node seg[trsz];
node merge(node a, node b){
node c;
c.v1 = min(a.v1, b.v1);
c.v2 = max(a.v2, b.v2);
c.ret1 = max(a.ret1, b.ret1);
c.ret1 = max(c.ret1, b.v2 - a.v1);
c.ret2 = max(a.ret2, b.ret2);
c.ret2 = max(c.ret2, a.v2 - b.v1);
return c;
}
void update(int x, int vl){
x += off;
seg[x].v1 = seg[x].v2 = vl;
for(x /= 2; x; x /= 2) seg[x] = merge(seg[x * 2], seg[x * 2 + 1]);
}
ii query(int l, int r){
if(l > r) return {0, 0};
node ret;
vi lef, rig;
for(l += off, r += off; l < r; l >>= 1, r >>= 1){
if(l & 1) lef.PB(l++);
if(r & 1) rig.PB(--r);
}
while(rig.size()) lef.PB(rig.back()), rig.PPB();
for(auto &x : lef) ret = merge(ret, seg[x]);
return {ret.ret1, ret.ret2};
}
int cm ;
int spusti(int x, int vl){
if(x >= off) return x - off;
if(seg[x * 2].ret1 >= vl or seg[x * 2].v2 - cm >= vl) return spusti(x * 2, vl);
cm = min(cm, seg[x * 2].v1);
return spusti(x * 2 + 1, vl);
}
int nadi(int l, int r, int vl){
vi lef, rig;
for(l += off, r += off; l < r; l >>= 1, r >>= 1){
if(l & 1) lef.PB(l++);
if(r & 1) rig.PB(--r);
}
while(rig.size()) lef.PB(rig.back()), rig.PPB();
cm = inf;
int ret = inf;
for(auto &x : lef){
if(seg[x].ret1 >= vl or seg[x].v2 - cm >= vl){
ret = spusti(x, vl);
return ret;
}
cm = min(cm, seg[x].v1);
}
return ret;
}
}del;
bool submit;
struct per{
struct node{
node *L, *R;
int cnt, mi, mx;
node(){
L = R = 0;
cnt = mi = mx = 0;
}
node(node *_L, node *_R, int _cnt, int _mi, int _mx){
L = _L, R = _R, cnt = _cnt, mi = _mi, mx = _mx;
}
};
typedef node* pnode;
pnode rt[MAXN];
set<pnode> st;
pnode l(pnode x){return x ? x -> L : 0;}
pnode r(pnode x){return x ? x -> R : 0;}
int c(pnode x){return x ? x -> cnt : 0;}
int sm(pnode x){return x ? x -> mi : 0;}
int bg(pnode x){return x ? x -> mx : 0;}
void update(pnode &x, int lo, int hi, int a, int b, int vl){
if(lo >= b or hi <= a) return;
if(!submit) st.insert(x);
x = new node(l(x), r(x), c(x), sm(x), bg(x));
if(!submit) st.insert(x);
if(lo >= a and hi <= b){
if(vl){
x -> cnt = 1;
x -> mi = lo;
x -> mx = lo;
}else{
x -> cnt = 0;
x -> mi = inf;
x -> mx = -inf;
}
return;
}
int mid = (lo + hi) / 2;
update(x -> L, lo, mid, a, b, vl);
update(x -> R, mid, hi, a, b, vl);
x -> mi = min(sm(x -> L), sm(x -> R));
x -> mx = max(bg(x -> L), bg(x -> R));
x -> cnt = c(x -> L) + c(x -> R);
}
int query(pnode &x, int lo, int hi, int a, int b){
if(lo >= b or hi <= a or !x) return 0;
if(lo >= a and hi <= b) return c(x);
int mid = (lo + hi) / 2;
return query(x -> L, lo, mid, a, b) + query(x -> R, mid, hi, a, b);
}
ii merge(ii a, ii b){
return {min(a.X, b.X), max(a.Y, b.Y)};
}
ii qry(pnode &x, int lo, int hi, int a, int b){
if(lo >= b or hi <= a or !x) return {inf, -inf};
if(lo >= a and hi <= b) return {sm(x), bg(x)};
int mid = (lo + hi) / 2;
return merge(qry(x -> L, lo, mid, a, b), qry(x -> R, mid, hi, a, b));
}
void update(int tim, int a, int b, int vl){
update(rt[tim], 0, off, a, b, vl);
}
void res(){
for(auto &x : st) delete x;
st.clear();
}
int query(int tim, int l, int r){
return query(rt[tim], 0, off, l, r);
}
ii query2(int tim, int l, int r){
return qry(rt[tim], 0, off, l, r);
}
}p;
int pm[MAXN], pv[MAXN], vl[MAXN], arr[MAXN];
vii st;
vi upd[MAXN], vals;
void init(int n, vi aa){
submit = 1;
for(int i=0; i<n; i++) arr[i + 1] = aa[i];
st.clear();
arr[0] = 2 * inf;
arr[n + 1] = 2 * inf;
t.update(0, 2 * inf);
t.update(n + 1, 2 * inf);
st.PB({-1, -inf});
for(int i=1; i<=n; i++){
while(st.back().Y > arr[i]) st.PPB();
pm[i] = st.back().X;
st.PB({i, arr[i]});
t.update(i, arr[i]);
del.update(i, arr[i]);
}
st.clear();
st.PB({n + 2, -inf});
for(int i=n; i; i--){
while(st.back().Y > arr[i]) st.PPB();
pv[i] = st.back().X;
st.PB({i, arr[i]});
}
for(int i=1; i<=n; i++){
int a = pm[i], b = pv[i];
int op = min(t.query(a + 1, i), t.query(i + 1, b));
op = max(op, arr[i]);
vl[i] = op - arr[i];
vals.PB(vl[i]);
}
vals.PB(0);
vals.PB(inf);
sort(all(vals));
vals.erase(unique(all(vals)), vals.end());
for(int i=1; i<=n; i++){
vl[i] = lower_bound(all(vals), vl[i]) - vals.begin();
upd[vl[i] + 1].PB(i);
}
p.rt[0] = NULL;
for(int i=1; i<=n; i++) p.update(0, i, i + 1, 1);
for(int i=1; i<(int)vals.size(); i++){
p.rt[i] = p.rt[i - 1];
for(auto &x : upd[i]) p.update(i, x, x + 1, 0);
}
}
int max_towers(int l, int r, int d){
l++, r++;
auto it = lower_bound(all(vals), d) - vals.begin();
int lef, rig, sum = p.query(it, l, r + 1);
if(sum == 0){
if(r - l + 1 >= 3){
int najl = del.nadi(l, r + 1, d);
if(del.query(najl, r + 1).Y >= d) return 2;
}
return 1;
}
tie(lef, rig) = p.query2(it, l, r + 1);
int opt = t.nadi(l, lef, arr[lef] + d, 1);
if(opt) if(del.query(l, opt + 1).X >= d) sum++;
opt = t.nadi(rig + 1, r + 1, arr[rig] + d, 0);
if(opt) if(del.query(opt, r + 1).Y >= d) sum++;
return sum;
}
void zavrsi(){
p.res();
}
Compilation message
towers.cpp:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
433 ms |
111712 KB |
Output is correct |
2 |
Correct |
903 ms |
181188 KB |
Output is correct |
3 |
Correct |
869 ms |
181212 KB |
Output is correct |
4 |
Correct |
889 ms |
181448 KB |
Output is correct |
5 |
Correct |
874 ms |
181444 KB |
Output is correct |
6 |
Correct |
918 ms |
181444 KB |
Output is correct |
7 |
Correct |
871 ms |
181444 KB |
Output is correct |
8 |
Correct |
1 ms |
9048 KB |
Output is correct |
9 |
Correct |
5 ms |
12632 KB |
Output is correct |
10 |
Correct |
4 ms |
12632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
5 ms |
12632 KB |
Output is correct |
3 |
Correct |
5 ms |
12632 KB |
Output is correct |
4 |
Correct |
5 ms |
12632 KB |
Output is correct |
5 |
Correct |
5 ms |
12632 KB |
Output is correct |
6 |
Correct |
5 ms |
12632 KB |
Output is correct |
7 |
Correct |
5 ms |
12632 KB |
Output is correct |
8 |
Correct |
5 ms |
12568 KB |
Output is correct |
9 |
Correct |
4 ms |
12632 KB |
Output is correct |
10 |
Correct |
5 ms |
12632 KB |
Output is correct |
11 |
Correct |
5 ms |
12632 KB |
Output is correct |
12 |
Correct |
2 ms |
9048 KB |
Output is correct |
13 |
Correct |
5 ms |
12632 KB |
Output is correct |
14 |
Correct |
5 ms |
12632 KB |
Output is correct |
15 |
Correct |
5 ms |
12632 KB |
Output is correct |
16 |
Correct |
5 ms |
12536 KB |
Output is correct |
17 |
Correct |
4 ms |
12632 KB |
Output is correct |
18 |
Correct |
4 ms |
12632 KB |
Output is correct |
19 |
Correct |
5 ms |
12632 KB |
Output is correct |
20 |
Correct |
5 ms |
12632 KB |
Output is correct |
21 |
Correct |
5 ms |
12632 KB |
Output is correct |
22 |
Correct |
5 ms |
12632 KB |
Output is correct |
23 |
Correct |
4 ms |
12632 KB |
Output is correct |
24 |
Correct |
4 ms |
12632 KB |
Output is correct |
25 |
Correct |
3 ms |
10584 KB |
Output is correct |
26 |
Correct |
5 ms |
12632 KB |
Output is correct |
27 |
Correct |
4 ms |
12560 KB |
Output is correct |
28 |
Correct |
4 ms |
12632 KB |
Output is correct |
29 |
Correct |
5 ms |
12632 KB |
Output is correct |
30 |
Correct |
4 ms |
12632 KB |
Output is correct |
31 |
Correct |
4 ms |
12552 KB |
Output is correct |
32 |
Correct |
5 ms |
12632 KB |
Output is correct |
33 |
Correct |
5 ms |
12632 KB |
Output is correct |
34 |
Correct |
4 ms |
12632 KB |
Output is correct |
35 |
Correct |
5 ms |
12632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
5 ms |
12632 KB |
Output is correct |
3 |
Correct |
5 ms |
12632 KB |
Output is correct |
4 |
Correct |
5 ms |
12632 KB |
Output is correct |
5 |
Correct |
5 ms |
12632 KB |
Output is correct |
6 |
Correct |
5 ms |
12632 KB |
Output is correct |
7 |
Correct |
5 ms |
12632 KB |
Output is correct |
8 |
Correct |
5 ms |
12568 KB |
Output is correct |
9 |
Correct |
4 ms |
12632 KB |
Output is correct |
10 |
Correct |
5 ms |
12632 KB |
Output is correct |
11 |
Correct |
5 ms |
12632 KB |
Output is correct |
12 |
Correct |
2 ms |
9048 KB |
Output is correct |
13 |
Correct |
5 ms |
12632 KB |
Output is correct |
14 |
Correct |
5 ms |
12632 KB |
Output is correct |
15 |
Correct |
5 ms |
12632 KB |
Output is correct |
16 |
Correct |
5 ms |
12536 KB |
Output is correct |
17 |
Correct |
4 ms |
12632 KB |
Output is correct |
18 |
Correct |
4 ms |
12632 KB |
Output is correct |
19 |
Correct |
5 ms |
12632 KB |
Output is correct |
20 |
Correct |
5 ms |
12632 KB |
Output is correct |
21 |
Correct |
5 ms |
12632 KB |
Output is correct |
22 |
Correct |
5 ms |
12632 KB |
Output is correct |
23 |
Correct |
4 ms |
12632 KB |
Output is correct |
24 |
Correct |
4 ms |
12632 KB |
Output is correct |
25 |
Correct |
3 ms |
10584 KB |
Output is correct |
26 |
Correct |
5 ms |
12632 KB |
Output is correct |
27 |
Correct |
4 ms |
12560 KB |
Output is correct |
28 |
Correct |
4 ms |
12632 KB |
Output is correct |
29 |
Correct |
5 ms |
12632 KB |
Output is correct |
30 |
Correct |
4 ms |
12632 KB |
Output is correct |
31 |
Correct |
4 ms |
12552 KB |
Output is correct |
32 |
Correct |
5 ms |
12632 KB |
Output is correct |
33 |
Correct |
5 ms |
12632 KB |
Output is correct |
34 |
Correct |
4 ms |
12632 KB |
Output is correct |
35 |
Correct |
5 ms |
12632 KB |
Output is correct |
36 |
Correct |
129 ms |
121384 KB |
Output is correct |
37 |
Correct |
190 ms |
181528 KB |
Output is correct |
38 |
Correct |
191 ms |
181516 KB |
Output is correct |
39 |
Correct |
186 ms |
181960 KB |
Output is correct |
40 |
Correct |
185 ms |
182020 KB |
Output is correct |
41 |
Correct |
190 ms |
181960 KB |
Output is correct |
42 |
Correct |
181 ms |
181968 KB |
Output is correct |
43 |
Correct |
165 ms |
181444 KB |
Output is correct |
44 |
Correct |
165 ms |
181444 KB |
Output is correct |
45 |
Correct |
166 ms |
180972 KB |
Output is correct |
46 |
Correct |
167 ms |
181124 KB |
Output is correct |
47 |
Correct |
182 ms |
181448 KB |
Output is correct |
48 |
Correct |
194 ms |
181924 KB |
Output is correct |
49 |
Correct |
184 ms |
181960 KB |
Output is correct |
50 |
Correct |
157 ms |
181444 KB |
Output is correct |
51 |
Correct |
167 ms |
181444 KB |
Output is correct |
52 |
Correct |
176 ms |
181448 KB |
Output is correct |
53 |
Correct |
187 ms |
181956 KB |
Output is correct |
54 |
Correct |
208 ms |
181912 KB |
Output is correct |
55 |
Correct |
156 ms |
181288 KB |
Output is correct |
56 |
Correct |
158 ms |
180944 KB |
Output is correct |
57 |
Correct |
183 ms |
175540 KB |
Output is correct |
58 |
Correct |
190 ms |
181372 KB |
Output is correct |
59 |
Correct |
179 ms |
181372 KB |
Output is correct |
60 |
Correct |
195 ms |
181992 KB |
Output is correct |
61 |
Correct |
203 ms |
181844 KB |
Output is correct |
62 |
Correct |
203 ms |
181960 KB |
Output is correct |
63 |
Correct |
188 ms |
181964 KB |
Output is correct |
64 |
Correct |
168 ms |
181444 KB |
Output is correct |
65 |
Correct |
153 ms |
181244 KB |
Output is correct |
66 |
Correct |
154 ms |
181068 KB |
Output is correct |
67 |
Correct |
160 ms |
181188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
682 ms |
180168 KB |
Output is correct |
2 |
Correct |
802 ms |
181448 KB |
Output is correct |
3 |
Correct |
876 ms |
181448 KB |
Output is correct |
4 |
Correct |
849 ms |
181920 KB |
Output is correct |
5 |
Correct |
828 ms |
181960 KB |
Output is correct |
6 |
Correct |
887 ms |
182036 KB |
Output is correct |
7 |
Correct |
838 ms |
181960 KB |
Output is correct |
8 |
Correct |
893 ms |
181524 KB |
Output is correct |
9 |
Correct |
815 ms |
181304 KB |
Output is correct |
10 |
Correct |
930 ms |
181188 KB |
Output is correct |
11 |
Correct |
883 ms |
181188 KB |
Output is correct |
12 |
Correct |
876 ms |
181444 KB |
Output is correct |
13 |
Correct |
812 ms |
181296 KB |
Output is correct |
14 |
Correct |
2 ms |
9048 KB |
Output is correct |
15 |
Correct |
6 ms |
12632 KB |
Output is correct |
16 |
Correct |
4 ms |
12632 KB |
Output is correct |
17 |
Correct |
186 ms |
181448 KB |
Output is correct |
18 |
Correct |
196 ms |
181960 KB |
Output is correct |
19 |
Correct |
191 ms |
181820 KB |
Output is correct |
20 |
Correct |
158 ms |
181444 KB |
Output is correct |
21 |
Correct |
158 ms |
181444 KB |
Output is correct |
22 |
Correct |
178 ms |
181460 KB |
Output is correct |
23 |
Correct |
193 ms |
181824 KB |
Output is correct |
24 |
Correct |
187 ms |
181960 KB |
Output is correct |
25 |
Correct |
158 ms |
181444 KB |
Output is correct |
26 |
Correct |
159 ms |
180828 KB |
Output is correct |
27 |
Correct |
5 ms |
12632 KB |
Output is correct |
28 |
Correct |
4 ms |
12632 KB |
Output is correct |
29 |
Correct |
4 ms |
12632 KB |
Output is correct |
30 |
Correct |
5 ms |
12632 KB |
Output is correct |
31 |
Correct |
4 ms |
12632 KB |
Output is correct |
32 |
Correct |
4 ms |
12488 KB |
Output is correct |
33 |
Correct |
4 ms |
12600 KB |
Output is correct |
34 |
Correct |
4 ms |
12632 KB |
Output is correct |
35 |
Correct |
4 ms |
12632 KB |
Output is correct |
36 |
Correct |
5 ms |
12632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
230 ms |
50256 KB |
Output is correct |
2 |
Correct |
793 ms |
181448 KB |
Output is correct |
3 |
Correct |
894 ms |
181448 KB |
Output is correct |
4 |
Correct |
806 ms |
181960 KB |
Output is correct |
5 |
Correct |
829 ms |
181960 KB |
Output is correct |
6 |
Correct |
878 ms |
181960 KB |
Output is correct |
7 |
Correct |
849 ms |
181960 KB |
Output is correct |
8 |
Correct |
826 ms |
181452 KB |
Output is correct |
9 |
Correct |
816 ms |
181408 KB |
Output is correct |
10 |
Correct |
855 ms |
181120 KB |
Output is correct |
11 |
Correct |
777 ms |
181208 KB |
Output is correct |
12 |
Correct |
186 ms |
181368 KB |
Output is correct |
13 |
Correct |
199 ms |
181844 KB |
Output is correct |
14 |
Correct |
194 ms |
181960 KB |
Output is correct |
15 |
Correct |
163 ms |
181416 KB |
Output is correct |
16 |
Correct |
174 ms |
180988 KB |
Output is correct |
17 |
Correct |
173 ms |
175708 KB |
Output is correct |
18 |
Correct |
177 ms |
181444 KB |
Output is correct |
19 |
Correct |
185 ms |
181448 KB |
Output is correct |
20 |
Correct |
198 ms |
181960 KB |
Output is correct |
21 |
Correct |
188 ms |
181864 KB |
Output is correct |
22 |
Correct |
191 ms |
181860 KB |
Output is correct |
23 |
Correct |
191 ms |
181960 KB |
Output is correct |
24 |
Correct |
160 ms |
181276 KB |
Output is correct |
25 |
Correct |
156 ms |
181444 KB |
Output is correct |
26 |
Correct |
186 ms |
180936 KB |
Output is correct |
27 |
Correct |
189 ms |
181252 KB |
Output is correct |
28 |
Correct |
4 ms |
12632 KB |
Output is correct |
29 |
Correct |
4 ms |
12632 KB |
Output is correct |
30 |
Correct |
4 ms |
12632 KB |
Output is correct |
31 |
Correct |
4 ms |
12632 KB |
Output is correct |
32 |
Correct |
4 ms |
12632 KB |
Output is correct |
33 |
Correct |
2 ms |
10584 KB |
Output is correct |
34 |
Correct |
4 ms |
12636 KB |
Output is correct |
35 |
Correct |
4 ms |
12632 KB |
Output is correct |
36 |
Correct |
4 ms |
12632 KB |
Output is correct |
37 |
Correct |
4 ms |
12632 KB |
Output is correct |
38 |
Correct |
4 ms |
12568 KB |
Output is correct |
39 |
Correct |
4 ms |
12604 KB |
Output is correct |
40 |
Correct |
4 ms |
12632 KB |
Output is correct |
41 |
Correct |
4 ms |
12532 KB |
Output is correct |
42 |
Correct |
5 ms |
12632 KB |
Output is correct |
43 |
Correct |
4 ms |
12552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
5 ms |
12632 KB |
Output is correct |
3 |
Correct |
5 ms |
12632 KB |
Output is correct |
4 |
Correct |
5 ms |
12632 KB |
Output is correct |
5 |
Correct |
5 ms |
12632 KB |
Output is correct |
6 |
Correct |
5 ms |
12632 KB |
Output is correct |
7 |
Correct |
5 ms |
12632 KB |
Output is correct |
8 |
Correct |
5 ms |
12568 KB |
Output is correct |
9 |
Correct |
4 ms |
12632 KB |
Output is correct |
10 |
Correct |
5 ms |
12632 KB |
Output is correct |
11 |
Correct |
5 ms |
12632 KB |
Output is correct |
12 |
Correct |
2 ms |
9048 KB |
Output is correct |
13 |
Correct |
5 ms |
12632 KB |
Output is correct |
14 |
Correct |
5 ms |
12632 KB |
Output is correct |
15 |
Correct |
5 ms |
12632 KB |
Output is correct |
16 |
Correct |
5 ms |
12536 KB |
Output is correct |
17 |
Correct |
4 ms |
12632 KB |
Output is correct |
18 |
Correct |
4 ms |
12632 KB |
Output is correct |
19 |
Correct |
5 ms |
12632 KB |
Output is correct |
20 |
Correct |
5 ms |
12632 KB |
Output is correct |
21 |
Correct |
5 ms |
12632 KB |
Output is correct |
22 |
Correct |
5 ms |
12632 KB |
Output is correct |
23 |
Correct |
4 ms |
12632 KB |
Output is correct |
24 |
Correct |
4 ms |
12632 KB |
Output is correct |
25 |
Correct |
3 ms |
10584 KB |
Output is correct |
26 |
Correct |
5 ms |
12632 KB |
Output is correct |
27 |
Correct |
4 ms |
12560 KB |
Output is correct |
28 |
Correct |
4 ms |
12632 KB |
Output is correct |
29 |
Correct |
5 ms |
12632 KB |
Output is correct |
30 |
Correct |
4 ms |
12632 KB |
Output is correct |
31 |
Correct |
4 ms |
12552 KB |
Output is correct |
32 |
Correct |
5 ms |
12632 KB |
Output is correct |
33 |
Correct |
5 ms |
12632 KB |
Output is correct |
34 |
Correct |
4 ms |
12632 KB |
Output is correct |
35 |
Correct |
5 ms |
12632 KB |
Output is correct |
36 |
Correct |
129 ms |
121384 KB |
Output is correct |
37 |
Correct |
190 ms |
181528 KB |
Output is correct |
38 |
Correct |
191 ms |
181516 KB |
Output is correct |
39 |
Correct |
186 ms |
181960 KB |
Output is correct |
40 |
Correct |
185 ms |
182020 KB |
Output is correct |
41 |
Correct |
190 ms |
181960 KB |
Output is correct |
42 |
Correct |
181 ms |
181968 KB |
Output is correct |
43 |
Correct |
165 ms |
181444 KB |
Output is correct |
44 |
Correct |
165 ms |
181444 KB |
Output is correct |
45 |
Correct |
166 ms |
180972 KB |
Output is correct |
46 |
Correct |
167 ms |
181124 KB |
Output is correct |
47 |
Correct |
182 ms |
181448 KB |
Output is correct |
48 |
Correct |
194 ms |
181924 KB |
Output is correct |
49 |
Correct |
184 ms |
181960 KB |
Output is correct |
50 |
Correct |
157 ms |
181444 KB |
Output is correct |
51 |
Correct |
167 ms |
181444 KB |
Output is correct |
52 |
Correct |
176 ms |
181448 KB |
Output is correct |
53 |
Correct |
187 ms |
181956 KB |
Output is correct |
54 |
Correct |
208 ms |
181912 KB |
Output is correct |
55 |
Correct |
156 ms |
181288 KB |
Output is correct |
56 |
Correct |
158 ms |
180944 KB |
Output is correct |
57 |
Correct |
183 ms |
175540 KB |
Output is correct |
58 |
Correct |
190 ms |
181372 KB |
Output is correct |
59 |
Correct |
179 ms |
181372 KB |
Output is correct |
60 |
Correct |
195 ms |
181992 KB |
Output is correct |
61 |
Correct |
203 ms |
181844 KB |
Output is correct |
62 |
Correct |
203 ms |
181960 KB |
Output is correct |
63 |
Correct |
188 ms |
181964 KB |
Output is correct |
64 |
Correct |
168 ms |
181444 KB |
Output is correct |
65 |
Correct |
153 ms |
181244 KB |
Output is correct |
66 |
Correct |
154 ms |
181068 KB |
Output is correct |
67 |
Correct |
160 ms |
181188 KB |
Output is correct |
68 |
Correct |
682 ms |
180168 KB |
Output is correct |
69 |
Correct |
802 ms |
181448 KB |
Output is correct |
70 |
Correct |
876 ms |
181448 KB |
Output is correct |
71 |
Correct |
849 ms |
181920 KB |
Output is correct |
72 |
Correct |
828 ms |
181960 KB |
Output is correct |
73 |
Correct |
887 ms |
182036 KB |
Output is correct |
74 |
Correct |
838 ms |
181960 KB |
Output is correct |
75 |
Correct |
893 ms |
181524 KB |
Output is correct |
76 |
Correct |
815 ms |
181304 KB |
Output is correct |
77 |
Correct |
930 ms |
181188 KB |
Output is correct |
78 |
Correct |
883 ms |
181188 KB |
Output is correct |
79 |
Correct |
876 ms |
181444 KB |
Output is correct |
80 |
Correct |
812 ms |
181296 KB |
Output is correct |
81 |
Correct |
2 ms |
9048 KB |
Output is correct |
82 |
Correct |
6 ms |
12632 KB |
Output is correct |
83 |
Correct |
4 ms |
12632 KB |
Output is correct |
84 |
Correct |
186 ms |
181448 KB |
Output is correct |
85 |
Correct |
196 ms |
181960 KB |
Output is correct |
86 |
Correct |
191 ms |
181820 KB |
Output is correct |
87 |
Correct |
158 ms |
181444 KB |
Output is correct |
88 |
Correct |
158 ms |
181444 KB |
Output is correct |
89 |
Correct |
178 ms |
181460 KB |
Output is correct |
90 |
Correct |
193 ms |
181824 KB |
Output is correct |
91 |
Correct |
187 ms |
181960 KB |
Output is correct |
92 |
Correct |
158 ms |
181444 KB |
Output is correct |
93 |
Correct |
159 ms |
180828 KB |
Output is correct |
94 |
Correct |
5 ms |
12632 KB |
Output is correct |
95 |
Correct |
4 ms |
12632 KB |
Output is correct |
96 |
Correct |
4 ms |
12632 KB |
Output is correct |
97 |
Correct |
5 ms |
12632 KB |
Output is correct |
98 |
Correct |
4 ms |
12632 KB |
Output is correct |
99 |
Correct |
4 ms |
12488 KB |
Output is correct |
100 |
Correct |
4 ms |
12600 KB |
Output is correct |
101 |
Correct |
4 ms |
12632 KB |
Output is correct |
102 |
Correct |
4 ms |
12632 KB |
Output is correct |
103 |
Correct |
5 ms |
12632 KB |
Output is correct |
104 |
Correct |
712 ms |
162172 KB |
Output is correct |
105 |
Correct |
887 ms |
181448 KB |
Output is correct |
106 |
Correct |
860 ms |
181384 KB |
Output is correct |
107 |
Correct |
873 ms |
181960 KB |
Output is correct |
108 |
Correct |
912 ms |
181996 KB |
Output is correct |
109 |
Correct |
860 ms |
181960 KB |
Output is correct |
110 |
Correct |
803 ms |
182000 KB |
Output is correct |
111 |
Correct |
863 ms |
181256 KB |
Output is correct |
112 |
Correct |
807 ms |
181320 KB |
Output is correct |
113 |
Correct |
899 ms |
180944 KB |
Output is correct |
114 |
Correct |
890 ms |
181320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
433 ms |
111712 KB |
Output is correct |
2 |
Correct |
903 ms |
181188 KB |
Output is correct |
3 |
Correct |
869 ms |
181212 KB |
Output is correct |
4 |
Correct |
889 ms |
181448 KB |
Output is correct |
5 |
Correct |
874 ms |
181444 KB |
Output is correct |
6 |
Correct |
918 ms |
181444 KB |
Output is correct |
7 |
Correct |
871 ms |
181444 KB |
Output is correct |
8 |
Correct |
1 ms |
9048 KB |
Output is correct |
9 |
Correct |
5 ms |
12632 KB |
Output is correct |
10 |
Correct |
4 ms |
12632 KB |
Output is correct |
11 |
Correct |
3 ms |
9816 KB |
Output is correct |
12 |
Correct |
5 ms |
12632 KB |
Output is correct |
13 |
Correct |
5 ms |
12632 KB |
Output is correct |
14 |
Correct |
5 ms |
12632 KB |
Output is correct |
15 |
Correct |
5 ms |
12632 KB |
Output is correct |
16 |
Correct |
5 ms |
12632 KB |
Output is correct |
17 |
Correct |
5 ms |
12632 KB |
Output is correct |
18 |
Correct |
5 ms |
12568 KB |
Output is correct |
19 |
Correct |
4 ms |
12632 KB |
Output is correct |
20 |
Correct |
5 ms |
12632 KB |
Output is correct |
21 |
Correct |
5 ms |
12632 KB |
Output is correct |
22 |
Correct |
2 ms |
9048 KB |
Output is correct |
23 |
Correct |
5 ms |
12632 KB |
Output is correct |
24 |
Correct |
5 ms |
12632 KB |
Output is correct |
25 |
Correct |
5 ms |
12632 KB |
Output is correct |
26 |
Correct |
5 ms |
12536 KB |
Output is correct |
27 |
Correct |
4 ms |
12632 KB |
Output is correct |
28 |
Correct |
4 ms |
12632 KB |
Output is correct |
29 |
Correct |
5 ms |
12632 KB |
Output is correct |
30 |
Correct |
5 ms |
12632 KB |
Output is correct |
31 |
Correct |
5 ms |
12632 KB |
Output is correct |
32 |
Correct |
5 ms |
12632 KB |
Output is correct |
33 |
Correct |
4 ms |
12632 KB |
Output is correct |
34 |
Correct |
4 ms |
12632 KB |
Output is correct |
35 |
Correct |
3 ms |
10584 KB |
Output is correct |
36 |
Correct |
5 ms |
12632 KB |
Output is correct |
37 |
Correct |
4 ms |
12560 KB |
Output is correct |
38 |
Correct |
4 ms |
12632 KB |
Output is correct |
39 |
Correct |
5 ms |
12632 KB |
Output is correct |
40 |
Correct |
4 ms |
12632 KB |
Output is correct |
41 |
Correct |
4 ms |
12552 KB |
Output is correct |
42 |
Correct |
5 ms |
12632 KB |
Output is correct |
43 |
Correct |
5 ms |
12632 KB |
Output is correct |
44 |
Correct |
4 ms |
12632 KB |
Output is correct |
45 |
Correct |
5 ms |
12632 KB |
Output is correct |
46 |
Correct |
129 ms |
121384 KB |
Output is correct |
47 |
Correct |
190 ms |
181528 KB |
Output is correct |
48 |
Correct |
191 ms |
181516 KB |
Output is correct |
49 |
Correct |
186 ms |
181960 KB |
Output is correct |
50 |
Correct |
185 ms |
182020 KB |
Output is correct |
51 |
Correct |
190 ms |
181960 KB |
Output is correct |
52 |
Correct |
181 ms |
181968 KB |
Output is correct |
53 |
Correct |
165 ms |
181444 KB |
Output is correct |
54 |
Correct |
165 ms |
181444 KB |
Output is correct |
55 |
Correct |
166 ms |
180972 KB |
Output is correct |
56 |
Correct |
167 ms |
181124 KB |
Output is correct |
57 |
Correct |
182 ms |
181448 KB |
Output is correct |
58 |
Correct |
194 ms |
181924 KB |
Output is correct |
59 |
Correct |
184 ms |
181960 KB |
Output is correct |
60 |
Correct |
157 ms |
181444 KB |
Output is correct |
61 |
Correct |
167 ms |
181444 KB |
Output is correct |
62 |
Correct |
176 ms |
181448 KB |
Output is correct |
63 |
Correct |
187 ms |
181956 KB |
Output is correct |
64 |
Correct |
208 ms |
181912 KB |
Output is correct |
65 |
Correct |
156 ms |
181288 KB |
Output is correct |
66 |
Correct |
158 ms |
180944 KB |
Output is correct |
67 |
Correct |
183 ms |
175540 KB |
Output is correct |
68 |
Correct |
190 ms |
181372 KB |
Output is correct |
69 |
Correct |
179 ms |
181372 KB |
Output is correct |
70 |
Correct |
195 ms |
181992 KB |
Output is correct |
71 |
Correct |
203 ms |
181844 KB |
Output is correct |
72 |
Correct |
203 ms |
181960 KB |
Output is correct |
73 |
Correct |
188 ms |
181964 KB |
Output is correct |
74 |
Correct |
168 ms |
181444 KB |
Output is correct |
75 |
Correct |
153 ms |
181244 KB |
Output is correct |
76 |
Correct |
154 ms |
181068 KB |
Output is correct |
77 |
Correct |
160 ms |
181188 KB |
Output is correct |
78 |
Correct |
682 ms |
180168 KB |
Output is correct |
79 |
Correct |
802 ms |
181448 KB |
Output is correct |
80 |
Correct |
876 ms |
181448 KB |
Output is correct |
81 |
Correct |
849 ms |
181920 KB |
Output is correct |
82 |
Correct |
828 ms |
181960 KB |
Output is correct |
83 |
Correct |
887 ms |
182036 KB |
Output is correct |
84 |
Correct |
838 ms |
181960 KB |
Output is correct |
85 |
Correct |
893 ms |
181524 KB |
Output is correct |
86 |
Correct |
815 ms |
181304 KB |
Output is correct |
87 |
Correct |
930 ms |
181188 KB |
Output is correct |
88 |
Correct |
883 ms |
181188 KB |
Output is correct |
89 |
Correct |
876 ms |
181444 KB |
Output is correct |
90 |
Correct |
812 ms |
181296 KB |
Output is correct |
91 |
Correct |
2 ms |
9048 KB |
Output is correct |
92 |
Correct |
6 ms |
12632 KB |
Output is correct |
93 |
Correct |
4 ms |
12632 KB |
Output is correct |
94 |
Correct |
186 ms |
181448 KB |
Output is correct |
95 |
Correct |
196 ms |
181960 KB |
Output is correct |
96 |
Correct |
191 ms |
181820 KB |
Output is correct |
97 |
Correct |
158 ms |
181444 KB |
Output is correct |
98 |
Correct |
158 ms |
181444 KB |
Output is correct |
99 |
Correct |
178 ms |
181460 KB |
Output is correct |
100 |
Correct |
193 ms |
181824 KB |
Output is correct |
101 |
Correct |
187 ms |
181960 KB |
Output is correct |
102 |
Correct |
158 ms |
181444 KB |
Output is correct |
103 |
Correct |
159 ms |
180828 KB |
Output is correct |
104 |
Correct |
5 ms |
12632 KB |
Output is correct |
105 |
Correct |
4 ms |
12632 KB |
Output is correct |
106 |
Correct |
4 ms |
12632 KB |
Output is correct |
107 |
Correct |
5 ms |
12632 KB |
Output is correct |
108 |
Correct |
4 ms |
12632 KB |
Output is correct |
109 |
Correct |
4 ms |
12488 KB |
Output is correct |
110 |
Correct |
4 ms |
12600 KB |
Output is correct |
111 |
Correct |
4 ms |
12632 KB |
Output is correct |
112 |
Correct |
4 ms |
12632 KB |
Output is correct |
113 |
Correct |
5 ms |
12632 KB |
Output is correct |
114 |
Correct |
230 ms |
50256 KB |
Output is correct |
115 |
Correct |
793 ms |
181448 KB |
Output is correct |
116 |
Correct |
894 ms |
181448 KB |
Output is correct |
117 |
Correct |
806 ms |
181960 KB |
Output is correct |
118 |
Correct |
829 ms |
181960 KB |
Output is correct |
119 |
Correct |
878 ms |
181960 KB |
Output is correct |
120 |
Correct |
849 ms |
181960 KB |
Output is correct |
121 |
Correct |
826 ms |
181452 KB |
Output is correct |
122 |
Correct |
816 ms |
181408 KB |
Output is correct |
123 |
Correct |
855 ms |
181120 KB |
Output is correct |
124 |
Correct |
777 ms |
181208 KB |
Output is correct |
125 |
Correct |
186 ms |
181368 KB |
Output is correct |
126 |
Correct |
199 ms |
181844 KB |
Output is correct |
127 |
Correct |
194 ms |
181960 KB |
Output is correct |
128 |
Correct |
163 ms |
181416 KB |
Output is correct |
129 |
Correct |
174 ms |
180988 KB |
Output is correct |
130 |
Correct |
173 ms |
175708 KB |
Output is correct |
131 |
Correct |
177 ms |
181444 KB |
Output is correct |
132 |
Correct |
185 ms |
181448 KB |
Output is correct |
133 |
Correct |
198 ms |
181960 KB |
Output is correct |
134 |
Correct |
188 ms |
181864 KB |
Output is correct |
135 |
Correct |
191 ms |
181860 KB |
Output is correct |
136 |
Correct |
191 ms |
181960 KB |
Output is correct |
137 |
Correct |
160 ms |
181276 KB |
Output is correct |
138 |
Correct |
156 ms |
181444 KB |
Output is correct |
139 |
Correct |
186 ms |
180936 KB |
Output is correct |
140 |
Correct |
189 ms |
181252 KB |
Output is correct |
141 |
Correct |
4 ms |
12632 KB |
Output is correct |
142 |
Correct |
4 ms |
12632 KB |
Output is correct |
143 |
Correct |
4 ms |
12632 KB |
Output is correct |
144 |
Correct |
4 ms |
12632 KB |
Output is correct |
145 |
Correct |
4 ms |
12632 KB |
Output is correct |
146 |
Correct |
2 ms |
10584 KB |
Output is correct |
147 |
Correct |
4 ms |
12636 KB |
Output is correct |
148 |
Correct |
4 ms |
12632 KB |
Output is correct |
149 |
Correct |
4 ms |
12632 KB |
Output is correct |
150 |
Correct |
4 ms |
12632 KB |
Output is correct |
151 |
Correct |
4 ms |
12568 KB |
Output is correct |
152 |
Correct |
4 ms |
12604 KB |
Output is correct |
153 |
Correct |
4 ms |
12632 KB |
Output is correct |
154 |
Correct |
4 ms |
12532 KB |
Output is correct |
155 |
Correct |
5 ms |
12632 KB |
Output is correct |
156 |
Correct |
4 ms |
12552 KB |
Output is correct |
157 |
Correct |
712 ms |
162172 KB |
Output is correct |
158 |
Correct |
887 ms |
181448 KB |
Output is correct |
159 |
Correct |
860 ms |
181384 KB |
Output is correct |
160 |
Correct |
873 ms |
181960 KB |
Output is correct |
161 |
Correct |
912 ms |
181996 KB |
Output is correct |
162 |
Correct |
860 ms |
181960 KB |
Output is correct |
163 |
Correct |
803 ms |
182000 KB |
Output is correct |
164 |
Correct |
863 ms |
181256 KB |
Output is correct |
165 |
Correct |
807 ms |
181320 KB |
Output is correct |
166 |
Correct |
899 ms |
180944 KB |
Output is correct |
167 |
Correct |
890 ms |
181320 KB |
Output is correct |
168 |
Correct |
2 ms |
9048 KB |
Output is correct |
169 |
Correct |
547 ms |
68996 KB |
Output is correct |
170 |
Correct |
1022 ms |
181448 KB |
Output is correct |
171 |
Correct |
1008 ms |
181448 KB |
Output is correct |
172 |
Correct |
1038 ms |
182020 KB |
Output is correct |
173 |
Correct |
1053 ms |
181960 KB |
Output is correct |
174 |
Correct |
1008 ms |
181828 KB |
Output is correct |
175 |
Correct |
1014 ms |
181848 KB |
Output is correct |
176 |
Correct |
845 ms |
181444 KB |
Output is correct |
177 |
Correct |
778 ms |
181444 KB |
Output is correct |
178 |
Correct |
908 ms |
181188 KB |
Output is correct |
179 |
Correct |
846 ms |
180944 KB |
Output is correct |