#include<bits/stdc++.h>
#include "towers.h"
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
#define pil pair<int,long long>
const int maxn=1e5+9;
int a[maxn],prv[maxn],nxt[maxn],mx1[maxn],mx2[maxn];
int st_max[maxn<<2];
void buildd(int id,int l,int r){
if (l==r){
st_max[id]=a[l];
return;
}
int mid=(l+r)>>1;
buildd(id<<1,l,mid);
buildd(id<<1|1,mid+1,r);
st_max[id]=max(st_max[id<<1],st_max[id<<1|1]);
}
int get_max(int id,int l,int r,int u,int v){
if (l>v||r<u||u>v)return 0;
if (u<=l&&r<=v)return st_max[id];
int mid=(l+r)>>1;
return max(get_max(id<<1,l,mid,u,v),get_max(id<<1|1,mid+1,r,u,v));
}
int n;
void build_pre(){
stack<int>t;
t.push(0);
for1(i,1,n){
while (!t.empty()&&a[t.top()]>a[i])t.pop();
prv[i]=t.top();
t.push(i);
mx1[i]=get_max(1,1,n,prv[i]+1,i-1)-a[i];
}
}
void build_suf(){
stack<int>t;
t.push(n+1);
for2(i,n,1){
while (!t.empty()&&a[t.top()]>a[i])t.pop();
nxt[i]=t.top();
t.push(i);
mx2[i]=get_max(1,1,n,i+1,nxt[i]-1)-a[i];
}
}
struct node{
vector<int>t;
int val,l,r;
node(){
t.clear();
val=l=r=0;
}
}st[10000009];
int lx[10000009],rx[10000009];
node cmp(const node &np, const node &nq,int d){
if (np.l==0)return nq;
if (nq.l==0)return np;
node p=np,q=nq,r;
r.val=p.val+q.val;
r.l=p.l,r.r=q.r;
while (!p.t.empty()){
auto u=p.t.back();
if (nxt[u]<=q.r&&nxt[u]>=q.l&&mx2[u]<d){
p.t.pop_back();
r.val--;
}
else break;
}
vector<int>tmp;
for (auto v:p.t){
tmp.pb(v);
}
for (auto v:q.t){
if (prv[v]>=p.l&&p.r>=prv[v]&&mx1[v]<d){
r.val--;
continue;
}
tmp.pb(v);
}
if (sz(tmp)==1){
r.t.pb(tmp[0]);
}
else if (sz(tmp)>=2){
r.t.pb(tmp[0]),r.t.pb(tmp.back());
}
return r;
}
int nnode=0;
int copy(int id){
nnode++;
lx[nnode]=lx[id];
rx[nnode]=rx[id];
return nnode;
}
int build(int id,int l,int r,int d){
st[id]=node();
st[id].l=l,st[id].r=r;
if (l==r){
st[id].val=1;
st[id].t.pb(l);
return id;
}
int mid=(l+r)>>1;
lx[id]=build(id<<1,l,mid,d);
rx[id]=build(id<<1|1,mid+1,r,d);
st[id]=cmp(st[id<<1],st[id<<1|1],d);
return id;
}
int update(int id,int l,int r,int u,int d){
if (l>u||r<u)return id;
if (l==r){
int newnode=copy(id);
st[newnode].val=1;
st[newnode].t.pb(l);
st[newnode].l=st[newnode].r=l;
return newnode;
}
int mid=(l+r)>>1;
int newnode=copy(id);
lx[newnode]=update(lx[id],l,mid,u,d);
rx[newnode]=update(rx[id],mid+1,r,u,d);
st[newnode]=cmp(st[lx[newnode]],st[rx[newnode]],d);
return newnode;
}
node get(int id,int l,int r,int u,int v,int d){
if (l>v||r<u||u>v)return node();
if (u<=l&&r<=v)return st[id];
int mid=(l+r)>>1;
return cmp(get(lx[id],l,mid,u,v,d),get(rx[id],mid+1,r,u,v,d),d);
}
vector<int>reup[maxn*2];
vector<int>value;
int root[maxn*2];
void init(int N, std::vector<int> H) {
n=N;
for1(i,1,n)a[i]=H[i-1];
buildd(1,1,n);
build_pre(),build_suf();
build(1,1,n,0);
value.pb(0);
for1(i,1,n){
mx1[i]=max(mx1[i],0),mx2[i]=max(mx2[i],0);
value.pb(mx1[i]),value.pb(mx2[i]);
}
sort(all(value));
value.resize(distance(value.begin(),unique(all(value))));
for1(i,1,n){
reup[lower_bound(all(value),mx1[i])-value.begin()].pb(i);
reup[lower_bound(all(value),mx2[i])-value.begin()].pb(i);
}
nnode=4*n;
root[0]=1;
for1(i,1,sz(value)-1){
root[i]=root[i-1];
for (auto v:reup[i]){
root[i]=update(root[i],1,n,v,value[i]+1);
}
}
}
int max_towers(int L, int R, int D) {
L++,R++;
int l=0,r=sz(value)-1,ans=0;
while (l<=r){
int mid=(l+r)>>1;
if (value[mid]<D){
ans=mid;
l=mid+1;
}
else r=mid-1;
}
node tmp=get(root[ans],1,n,L,R,D);
return tmp.val;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
804 ms |
453544 KB |
Output is correct |
2 |
Correct |
1456 ms |
488140 KB |
Output is correct |
3 |
Correct |
1470 ms |
488272 KB |
Output is correct |
4 |
Correct |
1473 ms |
488260 KB |
Output is correct |
5 |
Correct |
1393 ms |
488548 KB |
Output is correct |
6 |
Correct |
1314 ms |
488136 KB |
Output is correct |
7 |
Correct |
1332 ms |
488144 KB |
Output is correct |
8 |
Correct |
102 ms |
404488 KB |
Output is correct |
9 |
Correct |
95 ms |
405584 KB |
Output is correct |
10 |
Correct |
96 ms |
405528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
404756 KB |
Output is correct |
2 |
Correct |
98 ms |
405520 KB |
Output is correct |
3 |
Correct |
101 ms |
405624 KB |
Output is correct |
4 |
Correct |
98 ms |
405424 KB |
Output is correct |
5 |
Correct |
102 ms |
405584 KB |
Output is correct |
6 |
Correct |
98 ms |
405584 KB |
Output is correct |
7 |
Correct |
97 ms |
405624 KB |
Output is correct |
8 |
Correct |
97 ms |
405624 KB |
Output is correct |
9 |
Correct |
96 ms |
405584 KB |
Output is correct |
10 |
Correct |
99 ms |
405588 KB |
Output is correct |
11 |
Correct |
96 ms |
405584 KB |
Output is correct |
12 |
Correct |
92 ms |
404408 KB |
Output is correct |
13 |
Correct |
94 ms |
405404 KB |
Output is correct |
14 |
Correct |
97 ms |
405584 KB |
Output is correct |
15 |
Correct |
98 ms |
405572 KB |
Output is correct |
16 |
Correct |
100 ms |
405580 KB |
Output is correct |
17 |
Correct |
99 ms |
405588 KB |
Output is correct |
18 |
Correct |
98 ms |
405584 KB |
Output is correct |
19 |
Correct |
97 ms |
405584 KB |
Output is correct |
20 |
Correct |
104 ms |
405760 KB |
Output is correct |
21 |
Correct |
97 ms |
405584 KB |
Output is correct |
22 |
Correct |
101 ms |
405632 KB |
Output is correct |
23 |
Correct |
99 ms |
405504 KB |
Output is correct |
24 |
Correct |
96 ms |
405484 KB |
Output is correct |
25 |
Correct |
97 ms |
405072 KB |
Output is correct |
26 |
Correct |
99 ms |
405584 KB |
Output is correct |
27 |
Correct |
98 ms |
405456 KB |
Output is correct |
28 |
Correct |
101 ms |
405584 KB |
Output is correct |
29 |
Correct |
99 ms |
405584 KB |
Output is correct |
30 |
Correct |
98 ms |
405584 KB |
Output is correct |
31 |
Correct |
98 ms |
405584 KB |
Output is correct |
32 |
Correct |
96 ms |
405584 KB |
Output is correct |
33 |
Correct |
97 ms |
405584 KB |
Output is correct |
34 |
Correct |
101 ms |
405456 KB |
Output is correct |
35 |
Correct |
98 ms |
405512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
404756 KB |
Output is correct |
2 |
Correct |
98 ms |
405520 KB |
Output is correct |
3 |
Correct |
101 ms |
405624 KB |
Output is correct |
4 |
Correct |
98 ms |
405424 KB |
Output is correct |
5 |
Correct |
102 ms |
405584 KB |
Output is correct |
6 |
Correct |
98 ms |
405584 KB |
Output is correct |
7 |
Correct |
97 ms |
405624 KB |
Output is correct |
8 |
Correct |
97 ms |
405624 KB |
Output is correct |
9 |
Correct |
96 ms |
405584 KB |
Output is correct |
10 |
Correct |
99 ms |
405588 KB |
Output is correct |
11 |
Correct |
96 ms |
405584 KB |
Output is correct |
12 |
Correct |
92 ms |
404408 KB |
Output is correct |
13 |
Correct |
94 ms |
405404 KB |
Output is correct |
14 |
Correct |
97 ms |
405584 KB |
Output is correct |
15 |
Correct |
98 ms |
405572 KB |
Output is correct |
16 |
Correct |
100 ms |
405580 KB |
Output is correct |
17 |
Correct |
99 ms |
405588 KB |
Output is correct |
18 |
Correct |
98 ms |
405584 KB |
Output is correct |
19 |
Correct |
97 ms |
405584 KB |
Output is correct |
20 |
Correct |
104 ms |
405760 KB |
Output is correct |
21 |
Correct |
97 ms |
405584 KB |
Output is correct |
22 |
Correct |
101 ms |
405632 KB |
Output is correct |
23 |
Correct |
99 ms |
405504 KB |
Output is correct |
24 |
Correct |
96 ms |
405484 KB |
Output is correct |
25 |
Correct |
97 ms |
405072 KB |
Output is correct |
26 |
Correct |
99 ms |
405584 KB |
Output is correct |
27 |
Correct |
98 ms |
405456 KB |
Output is correct |
28 |
Correct |
101 ms |
405584 KB |
Output is correct |
29 |
Correct |
99 ms |
405584 KB |
Output is correct |
30 |
Correct |
98 ms |
405584 KB |
Output is correct |
31 |
Correct |
98 ms |
405584 KB |
Output is correct |
32 |
Correct |
96 ms |
405584 KB |
Output is correct |
33 |
Correct |
97 ms |
405584 KB |
Output is correct |
34 |
Correct |
101 ms |
405456 KB |
Output is correct |
35 |
Correct |
98 ms |
405512 KB |
Output is correct |
36 |
Correct |
455 ms |
459284 KB |
Output is correct |
37 |
Correct |
660 ms |
488428 KB |
Output is correct |
38 |
Correct |
668 ms |
488476 KB |
Output is correct |
39 |
Correct |
686 ms |
488132 KB |
Output is correct |
40 |
Correct |
655 ms |
488140 KB |
Output is correct |
41 |
Correct |
664 ms |
488384 KB |
Output is correct |
42 |
Correct |
669 ms |
488328 KB |
Output is correct |
43 |
Correct |
398 ms |
488356 KB |
Output is correct |
44 |
Correct |
396 ms |
488196 KB |
Output is correct |
45 |
Correct |
411 ms |
488252 KB |
Output is correct |
46 |
Correct |
405 ms |
488252 KB |
Output is correct |
47 |
Correct |
679 ms |
488476 KB |
Output is correct |
48 |
Correct |
656 ms |
488284 KB |
Output is correct |
49 |
Correct |
662 ms |
488216 KB |
Output is correct |
50 |
Correct |
394 ms |
488188 KB |
Output is correct |
51 |
Correct |
401 ms |
488128 KB |
Output is correct |
52 |
Correct |
639 ms |
488388 KB |
Output is correct |
53 |
Correct |
654 ms |
488488 KB |
Output is correct |
54 |
Correct |
627 ms |
488368 KB |
Output is correct |
55 |
Correct |
386 ms |
488348 KB |
Output is correct |
56 |
Correct |
421 ms |
488312 KB |
Output is correct |
57 |
Correct |
647 ms |
485808 KB |
Output is correct |
58 |
Correct |
638 ms |
488368 KB |
Output is correct |
59 |
Correct |
673 ms |
488172 KB |
Output is correct |
60 |
Correct |
694 ms |
488256 KB |
Output is correct |
61 |
Correct |
670 ms |
488228 KB |
Output is correct |
62 |
Correct |
640 ms |
488660 KB |
Output is correct |
63 |
Correct |
641 ms |
488364 KB |
Output is correct |
64 |
Correct |
394 ms |
488192 KB |
Output is correct |
65 |
Correct |
443 ms |
488356 KB |
Output is correct |
66 |
Correct |
419 ms |
488592 KB |
Output is correct |
67 |
Correct |
399 ms |
488220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1393 ms |
487848 KB |
Output is correct |
2 |
Correct |
1624 ms |
488192 KB |
Output is correct |
3 |
Correct |
1658 ms |
488364 KB |
Output is correct |
4 |
Correct |
1599 ms |
488292 KB |
Output is correct |
5 |
Correct |
1611 ms |
488364 KB |
Output is correct |
6 |
Correct |
1662 ms |
488472 KB |
Output is correct |
7 |
Correct |
1671 ms |
488180 KB |
Output is correct |
8 |
Correct |
1296 ms |
488356 KB |
Output is correct |
9 |
Correct |
1261 ms |
488212 KB |
Output is correct |
10 |
Correct |
1340 ms |
488232 KB |
Output is correct |
11 |
Correct |
1388 ms |
488228 KB |
Output is correct |
12 |
Correct |
1262 ms |
488372 KB |
Output is correct |
13 |
Correct |
1248 ms |
488232 KB |
Output is correct |
14 |
Correct |
91 ms |
404500 KB |
Output is correct |
15 |
Correct |
96 ms |
405404 KB |
Output is correct |
16 |
Correct |
99 ms |
405776 KB |
Output is correct |
17 |
Correct |
635 ms |
488176 KB |
Output is correct |
18 |
Correct |
634 ms |
488628 KB |
Output is correct |
19 |
Correct |
641 ms |
488372 KB |
Output is correct |
20 |
Correct |
392 ms |
488356 KB |
Output is correct |
21 |
Correct |
395 ms |
488336 KB |
Output is correct |
22 |
Correct |
643 ms |
488512 KB |
Output is correct |
23 |
Correct |
657 ms |
488268 KB |
Output is correct |
24 |
Correct |
651 ms |
488384 KB |
Output is correct |
25 |
Correct |
387 ms |
488360 KB |
Output is correct |
26 |
Correct |
426 ms |
488368 KB |
Output is correct |
27 |
Correct |
100 ms |
405604 KB |
Output is correct |
28 |
Correct |
101 ms |
405396 KB |
Output is correct |
29 |
Correct |
101 ms |
405644 KB |
Output is correct |
30 |
Correct |
96 ms |
405452 KB |
Output is correct |
31 |
Correct |
98 ms |
405584 KB |
Output is correct |
32 |
Correct |
99 ms |
405584 KB |
Output is correct |
33 |
Correct |
101 ms |
405580 KB |
Output is correct |
34 |
Correct |
100 ms |
405584 KB |
Output is correct |
35 |
Correct |
99 ms |
405432 KB |
Output is correct |
36 |
Correct |
98 ms |
405568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
361 ms |
423368 KB |
Output is correct |
2 |
Correct |
1244 ms |
488380 KB |
Output is correct |
3 |
Correct |
1224 ms |
488352 KB |
Output is correct |
4 |
Correct |
1221 ms |
488312 KB |
Output is correct |
5 |
Correct |
1216 ms |
488320 KB |
Output is correct |
6 |
Correct |
1262 ms |
488356 KB |
Output is correct |
7 |
Correct |
1209 ms |
488368 KB |
Output is correct |
8 |
Correct |
999 ms |
488328 KB |
Output is correct |
9 |
Correct |
980 ms |
488352 KB |
Output is correct |
10 |
Correct |
1047 ms |
488336 KB |
Output is correct |
11 |
Correct |
1029 ms |
488192 KB |
Output is correct |
12 |
Correct |
634 ms |
488368 KB |
Output is correct |
13 |
Correct |
636 ms |
488364 KB |
Output is correct |
14 |
Correct |
641 ms |
488204 KB |
Output is correct |
15 |
Correct |
397 ms |
488360 KB |
Output is correct |
16 |
Correct |
487 ms |
488256 KB |
Output is correct |
17 |
Correct |
633 ms |
485748 KB |
Output is correct |
18 |
Correct |
658 ms |
488204 KB |
Output is correct |
19 |
Correct |
636 ms |
488252 KB |
Output is correct |
20 |
Correct |
652 ms |
488132 KB |
Output is correct |
21 |
Correct |
630 ms |
488452 KB |
Output is correct |
22 |
Correct |
671 ms |
488252 KB |
Output is correct |
23 |
Correct |
651 ms |
488380 KB |
Output is correct |
24 |
Correct |
386 ms |
488340 KB |
Output is correct |
25 |
Correct |
384 ms |
488260 KB |
Output is correct |
26 |
Correct |
418 ms |
488284 KB |
Output is correct |
27 |
Correct |
394 ms |
488380 KB |
Output is correct |
28 |
Correct |
100 ms |
405532 KB |
Output is correct |
29 |
Correct |
100 ms |
405620 KB |
Output is correct |
30 |
Correct |
100 ms |
405568 KB |
Output is correct |
31 |
Correct |
97 ms |
405584 KB |
Output is correct |
32 |
Correct |
97 ms |
405464 KB |
Output is correct |
33 |
Correct |
99 ms |
404840 KB |
Output is correct |
34 |
Correct |
99 ms |
405640 KB |
Output is correct |
35 |
Correct |
100 ms |
405584 KB |
Output is correct |
36 |
Correct |
100 ms |
405568 KB |
Output is correct |
37 |
Correct |
105 ms |
405588 KB |
Output is correct |
38 |
Correct |
98 ms |
405616 KB |
Output is correct |
39 |
Correct |
100 ms |
405632 KB |
Output is correct |
40 |
Correct |
99 ms |
405584 KB |
Output is correct |
41 |
Correct |
101 ms |
405568 KB |
Output is correct |
42 |
Correct |
97 ms |
405584 KB |
Output is correct |
43 |
Correct |
97 ms |
405484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
404756 KB |
Output is correct |
2 |
Correct |
98 ms |
405520 KB |
Output is correct |
3 |
Correct |
101 ms |
405624 KB |
Output is correct |
4 |
Correct |
98 ms |
405424 KB |
Output is correct |
5 |
Correct |
102 ms |
405584 KB |
Output is correct |
6 |
Correct |
98 ms |
405584 KB |
Output is correct |
7 |
Correct |
97 ms |
405624 KB |
Output is correct |
8 |
Correct |
97 ms |
405624 KB |
Output is correct |
9 |
Correct |
96 ms |
405584 KB |
Output is correct |
10 |
Correct |
99 ms |
405588 KB |
Output is correct |
11 |
Correct |
96 ms |
405584 KB |
Output is correct |
12 |
Correct |
92 ms |
404408 KB |
Output is correct |
13 |
Correct |
94 ms |
405404 KB |
Output is correct |
14 |
Correct |
97 ms |
405584 KB |
Output is correct |
15 |
Correct |
98 ms |
405572 KB |
Output is correct |
16 |
Correct |
100 ms |
405580 KB |
Output is correct |
17 |
Correct |
99 ms |
405588 KB |
Output is correct |
18 |
Correct |
98 ms |
405584 KB |
Output is correct |
19 |
Correct |
97 ms |
405584 KB |
Output is correct |
20 |
Correct |
104 ms |
405760 KB |
Output is correct |
21 |
Correct |
97 ms |
405584 KB |
Output is correct |
22 |
Correct |
101 ms |
405632 KB |
Output is correct |
23 |
Correct |
99 ms |
405504 KB |
Output is correct |
24 |
Correct |
96 ms |
405484 KB |
Output is correct |
25 |
Correct |
97 ms |
405072 KB |
Output is correct |
26 |
Correct |
99 ms |
405584 KB |
Output is correct |
27 |
Correct |
98 ms |
405456 KB |
Output is correct |
28 |
Correct |
101 ms |
405584 KB |
Output is correct |
29 |
Correct |
99 ms |
405584 KB |
Output is correct |
30 |
Correct |
98 ms |
405584 KB |
Output is correct |
31 |
Correct |
98 ms |
405584 KB |
Output is correct |
32 |
Correct |
96 ms |
405584 KB |
Output is correct |
33 |
Correct |
97 ms |
405584 KB |
Output is correct |
34 |
Correct |
101 ms |
405456 KB |
Output is correct |
35 |
Correct |
98 ms |
405512 KB |
Output is correct |
36 |
Correct |
455 ms |
459284 KB |
Output is correct |
37 |
Correct |
660 ms |
488428 KB |
Output is correct |
38 |
Correct |
668 ms |
488476 KB |
Output is correct |
39 |
Correct |
686 ms |
488132 KB |
Output is correct |
40 |
Correct |
655 ms |
488140 KB |
Output is correct |
41 |
Correct |
664 ms |
488384 KB |
Output is correct |
42 |
Correct |
669 ms |
488328 KB |
Output is correct |
43 |
Correct |
398 ms |
488356 KB |
Output is correct |
44 |
Correct |
396 ms |
488196 KB |
Output is correct |
45 |
Correct |
411 ms |
488252 KB |
Output is correct |
46 |
Correct |
405 ms |
488252 KB |
Output is correct |
47 |
Correct |
679 ms |
488476 KB |
Output is correct |
48 |
Correct |
656 ms |
488284 KB |
Output is correct |
49 |
Correct |
662 ms |
488216 KB |
Output is correct |
50 |
Correct |
394 ms |
488188 KB |
Output is correct |
51 |
Correct |
401 ms |
488128 KB |
Output is correct |
52 |
Correct |
639 ms |
488388 KB |
Output is correct |
53 |
Correct |
654 ms |
488488 KB |
Output is correct |
54 |
Correct |
627 ms |
488368 KB |
Output is correct |
55 |
Correct |
386 ms |
488348 KB |
Output is correct |
56 |
Correct |
421 ms |
488312 KB |
Output is correct |
57 |
Correct |
647 ms |
485808 KB |
Output is correct |
58 |
Correct |
638 ms |
488368 KB |
Output is correct |
59 |
Correct |
673 ms |
488172 KB |
Output is correct |
60 |
Correct |
694 ms |
488256 KB |
Output is correct |
61 |
Correct |
670 ms |
488228 KB |
Output is correct |
62 |
Correct |
640 ms |
488660 KB |
Output is correct |
63 |
Correct |
641 ms |
488364 KB |
Output is correct |
64 |
Correct |
394 ms |
488192 KB |
Output is correct |
65 |
Correct |
443 ms |
488356 KB |
Output is correct |
66 |
Correct |
419 ms |
488592 KB |
Output is correct |
67 |
Correct |
399 ms |
488220 KB |
Output is correct |
68 |
Correct |
1393 ms |
487848 KB |
Output is correct |
69 |
Correct |
1624 ms |
488192 KB |
Output is correct |
70 |
Correct |
1658 ms |
488364 KB |
Output is correct |
71 |
Correct |
1599 ms |
488292 KB |
Output is correct |
72 |
Correct |
1611 ms |
488364 KB |
Output is correct |
73 |
Correct |
1662 ms |
488472 KB |
Output is correct |
74 |
Correct |
1671 ms |
488180 KB |
Output is correct |
75 |
Correct |
1296 ms |
488356 KB |
Output is correct |
76 |
Correct |
1261 ms |
488212 KB |
Output is correct |
77 |
Correct |
1340 ms |
488232 KB |
Output is correct |
78 |
Correct |
1388 ms |
488228 KB |
Output is correct |
79 |
Correct |
1262 ms |
488372 KB |
Output is correct |
80 |
Correct |
1248 ms |
488232 KB |
Output is correct |
81 |
Correct |
91 ms |
404500 KB |
Output is correct |
82 |
Correct |
96 ms |
405404 KB |
Output is correct |
83 |
Correct |
99 ms |
405776 KB |
Output is correct |
84 |
Correct |
635 ms |
488176 KB |
Output is correct |
85 |
Correct |
634 ms |
488628 KB |
Output is correct |
86 |
Correct |
641 ms |
488372 KB |
Output is correct |
87 |
Correct |
392 ms |
488356 KB |
Output is correct |
88 |
Correct |
395 ms |
488336 KB |
Output is correct |
89 |
Correct |
643 ms |
488512 KB |
Output is correct |
90 |
Correct |
657 ms |
488268 KB |
Output is correct |
91 |
Correct |
651 ms |
488384 KB |
Output is correct |
92 |
Correct |
387 ms |
488360 KB |
Output is correct |
93 |
Correct |
426 ms |
488368 KB |
Output is correct |
94 |
Correct |
100 ms |
405604 KB |
Output is correct |
95 |
Correct |
101 ms |
405396 KB |
Output is correct |
96 |
Correct |
101 ms |
405644 KB |
Output is correct |
97 |
Correct |
96 ms |
405452 KB |
Output is correct |
98 |
Correct |
98 ms |
405584 KB |
Output is correct |
99 |
Correct |
99 ms |
405584 KB |
Output is correct |
100 |
Correct |
101 ms |
405580 KB |
Output is correct |
101 |
Correct |
100 ms |
405584 KB |
Output is correct |
102 |
Correct |
99 ms |
405432 KB |
Output is correct |
103 |
Correct |
98 ms |
405568 KB |
Output is correct |
104 |
Correct |
1394 ms |
480356 KB |
Output is correct |
105 |
Correct |
1726 ms |
488304 KB |
Output is correct |
106 |
Correct |
1635 ms |
488572 KB |
Output is correct |
107 |
Correct |
1619 ms |
488368 KB |
Output is correct |
108 |
Correct |
1620 ms |
488520 KB |
Output is correct |
109 |
Correct |
1707 ms |
488264 KB |
Output is correct |
110 |
Correct |
1591 ms |
488352 KB |
Output is correct |
111 |
Correct |
1250 ms |
488352 KB |
Output is correct |
112 |
Correct |
1252 ms |
488284 KB |
Output is correct |
113 |
Correct |
1320 ms |
488496 KB |
Output is correct |
114 |
Correct |
1300 ms |
488276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
804 ms |
453544 KB |
Output is correct |
2 |
Correct |
1456 ms |
488140 KB |
Output is correct |
3 |
Correct |
1470 ms |
488272 KB |
Output is correct |
4 |
Correct |
1473 ms |
488260 KB |
Output is correct |
5 |
Correct |
1393 ms |
488548 KB |
Output is correct |
6 |
Correct |
1314 ms |
488136 KB |
Output is correct |
7 |
Correct |
1332 ms |
488144 KB |
Output is correct |
8 |
Correct |
102 ms |
404488 KB |
Output is correct |
9 |
Correct |
95 ms |
405584 KB |
Output is correct |
10 |
Correct |
96 ms |
405528 KB |
Output is correct |
11 |
Correct |
94 ms |
404756 KB |
Output is correct |
12 |
Correct |
98 ms |
405520 KB |
Output is correct |
13 |
Correct |
101 ms |
405624 KB |
Output is correct |
14 |
Correct |
98 ms |
405424 KB |
Output is correct |
15 |
Correct |
102 ms |
405584 KB |
Output is correct |
16 |
Correct |
98 ms |
405584 KB |
Output is correct |
17 |
Correct |
97 ms |
405624 KB |
Output is correct |
18 |
Correct |
97 ms |
405624 KB |
Output is correct |
19 |
Correct |
96 ms |
405584 KB |
Output is correct |
20 |
Correct |
99 ms |
405588 KB |
Output is correct |
21 |
Correct |
96 ms |
405584 KB |
Output is correct |
22 |
Correct |
92 ms |
404408 KB |
Output is correct |
23 |
Correct |
94 ms |
405404 KB |
Output is correct |
24 |
Correct |
97 ms |
405584 KB |
Output is correct |
25 |
Correct |
98 ms |
405572 KB |
Output is correct |
26 |
Correct |
100 ms |
405580 KB |
Output is correct |
27 |
Correct |
99 ms |
405588 KB |
Output is correct |
28 |
Correct |
98 ms |
405584 KB |
Output is correct |
29 |
Correct |
97 ms |
405584 KB |
Output is correct |
30 |
Correct |
104 ms |
405760 KB |
Output is correct |
31 |
Correct |
97 ms |
405584 KB |
Output is correct |
32 |
Correct |
101 ms |
405632 KB |
Output is correct |
33 |
Correct |
99 ms |
405504 KB |
Output is correct |
34 |
Correct |
96 ms |
405484 KB |
Output is correct |
35 |
Correct |
97 ms |
405072 KB |
Output is correct |
36 |
Correct |
99 ms |
405584 KB |
Output is correct |
37 |
Correct |
98 ms |
405456 KB |
Output is correct |
38 |
Correct |
101 ms |
405584 KB |
Output is correct |
39 |
Correct |
99 ms |
405584 KB |
Output is correct |
40 |
Correct |
98 ms |
405584 KB |
Output is correct |
41 |
Correct |
98 ms |
405584 KB |
Output is correct |
42 |
Correct |
96 ms |
405584 KB |
Output is correct |
43 |
Correct |
97 ms |
405584 KB |
Output is correct |
44 |
Correct |
101 ms |
405456 KB |
Output is correct |
45 |
Correct |
98 ms |
405512 KB |
Output is correct |
46 |
Correct |
455 ms |
459284 KB |
Output is correct |
47 |
Correct |
660 ms |
488428 KB |
Output is correct |
48 |
Correct |
668 ms |
488476 KB |
Output is correct |
49 |
Correct |
686 ms |
488132 KB |
Output is correct |
50 |
Correct |
655 ms |
488140 KB |
Output is correct |
51 |
Correct |
664 ms |
488384 KB |
Output is correct |
52 |
Correct |
669 ms |
488328 KB |
Output is correct |
53 |
Correct |
398 ms |
488356 KB |
Output is correct |
54 |
Correct |
396 ms |
488196 KB |
Output is correct |
55 |
Correct |
411 ms |
488252 KB |
Output is correct |
56 |
Correct |
405 ms |
488252 KB |
Output is correct |
57 |
Correct |
679 ms |
488476 KB |
Output is correct |
58 |
Correct |
656 ms |
488284 KB |
Output is correct |
59 |
Correct |
662 ms |
488216 KB |
Output is correct |
60 |
Correct |
394 ms |
488188 KB |
Output is correct |
61 |
Correct |
401 ms |
488128 KB |
Output is correct |
62 |
Correct |
639 ms |
488388 KB |
Output is correct |
63 |
Correct |
654 ms |
488488 KB |
Output is correct |
64 |
Correct |
627 ms |
488368 KB |
Output is correct |
65 |
Correct |
386 ms |
488348 KB |
Output is correct |
66 |
Correct |
421 ms |
488312 KB |
Output is correct |
67 |
Correct |
647 ms |
485808 KB |
Output is correct |
68 |
Correct |
638 ms |
488368 KB |
Output is correct |
69 |
Correct |
673 ms |
488172 KB |
Output is correct |
70 |
Correct |
694 ms |
488256 KB |
Output is correct |
71 |
Correct |
670 ms |
488228 KB |
Output is correct |
72 |
Correct |
640 ms |
488660 KB |
Output is correct |
73 |
Correct |
641 ms |
488364 KB |
Output is correct |
74 |
Correct |
394 ms |
488192 KB |
Output is correct |
75 |
Correct |
443 ms |
488356 KB |
Output is correct |
76 |
Correct |
419 ms |
488592 KB |
Output is correct |
77 |
Correct |
399 ms |
488220 KB |
Output is correct |
78 |
Correct |
1393 ms |
487848 KB |
Output is correct |
79 |
Correct |
1624 ms |
488192 KB |
Output is correct |
80 |
Correct |
1658 ms |
488364 KB |
Output is correct |
81 |
Correct |
1599 ms |
488292 KB |
Output is correct |
82 |
Correct |
1611 ms |
488364 KB |
Output is correct |
83 |
Correct |
1662 ms |
488472 KB |
Output is correct |
84 |
Correct |
1671 ms |
488180 KB |
Output is correct |
85 |
Correct |
1296 ms |
488356 KB |
Output is correct |
86 |
Correct |
1261 ms |
488212 KB |
Output is correct |
87 |
Correct |
1340 ms |
488232 KB |
Output is correct |
88 |
Correct |
1388 ms |
488228 KB |
Output is correct |
89 |
Correct |
1262 ms |
488372 KB |
Output is correct |
90 |
Correct |
1248 ms |
488232 KB |
Output is correct |
91 |
Correct |
91 ms |
404500 KB |
Output is correct |
92 |
Correct |
96 ms |
405404 KB |
Output is correct |
93 |
Correct |
99 ms |
405776 KB |
Output is correct |
94 |
Correct |
635 ms |
488176 KB |
Output is correct |
95 |
Correct |
634 ms |
488628 KB |
Output is correct |
96 |
Correct |
641 ms |
488372 KB |
Output is correct |
97 |
Correct |
392 ms |
488356 KB |
Output is correct |
98 |
Correct |
395 ms |
488336 KB |
Output is correct |
99 |
Correct |
643 ms |
488512 KB |
Output is correct |
100 |
Correct |
657 ms |
488268 KB |
Output is correct |
101 |
Correct |
651 ms |
488384 KB |
Output is correct |
102 |
Correct |
387 ms |
488360 KB |
Output is correct |
103 |
Correct |
426 ms |
488368 KB |
Output is correct |
104 |
Correct |
100 ms |
405604 KB |
Output is correct |
105 |
Correct |
101 ms |
405396 KB |
Output is correct |
106 |
Correct |
101 ms |
405644 KB |
Output is correct |
107 |
Correct |
96 ms |
405452 KB |
Output is correct |
108 |
Correct |
98 ms |
405584 KB |
Output is correct |
109 |
Correct |
99 ms |
405584 KB |
Output is correct |
110 |
Correct |
101 ms |
405580 KB |
Output is correct |
111 |
Correct |
100 ms |
405584 KB |
Output is correct |
112 |
Correct |
99 ms |
405432 KB |
Output is correct |
113 |
Correct |
98 ms |
405568 KB |
Output is correct |
114 |
Correct |
361 ms |
423368 KB |
Output is correct |
115 |
Correct |
1244 ms |
488380 KB |
Output is correct |
116 |
Correct |
1224 ms |
488352 KB |
Output is correct |
117 |
Correct |
1221 ms |
488312 KB |
Output is correct |
118 |
Correct |
1216 ms |
488320 KB |
Output is correct |
119 |
Correct |
1262 ms |
488356 KB |
Output is correct |
120 |
Correct |
1209 ms |
488368 KB |
Output is correct |
121 |
Correct |
999 ms |
488328 KB |
Output is correct |
122 |
Correct |
980 ms |
488352 KB |
Output is correct |
123 |
Correct |
1047 ms |
488336 KB |
Output is correct |
124 |
Correct |
1029 ms |
488192 KB |
Output is correct |
125 |
Correct |
634 ms |
488368 KB |
Output is correct |
126 |
Correct |
636 ms |
488364 KB |
Output is correct |
127 |
Correct |
641 ms |
488204 KB |
Output is correct |
128 |
Correct |
397 ms |
488360 KB |
Output is correct |
129 |
Correct |
487 ms |
488256 KB |
Output is correct |
130 |
Correct |
633 ms |
485748 KB |
Output is correct |
131 |
Correct |
658 ms |
488204 KB |
Output is correct |
132 |
Correct |
636 ms |
488252 KB |
Output is correct |
133 |
Correct |
652 ms |
488132 KB |
Output is correct |
134 |
Correct |
630 ms |
488452 KB |
Output is correct |
135 |
Correct |
671 ms |
488252 KB |
Output is correct |
136 |
Correct |
651 ms |
488380 KB |
Output is correct |
137 |
Correct |
386 ms |
488340 KB |
Output is correct |
138 |
Correct |
384 ms |
488260 KB |
Output is correct |
139 |
Correct |
418 ms |
488284 KB |
Output is correct |
140 |
Correct |
394 ms |
488380 KB |
Output is correct |
141 |
Correct |
100 ms |
405532 KB |
Output is correct |
142 |
Correct |
100 ms |
405620 KB |
Output is correct |
143 |
Correct |
100 ms |
405568 KB |
Output is correct |
144 |
Correct |
97 ms |
405584 KB |
Output is correct |
145 |
Correct |
97 ms |
405464 KB |
Output is correct |
146 |
Correct |
99 ms |
404840 KB |
Output is correct |
147 |
Correct |
99 ms |
405640 KB |
Output is correct |
148 |
Correct |
100 ms |
405584 KB |
Output is correct |
149 |
Correct |
100 ms |
405568 KB |
Output is correct |
150 |
Correct |
105 ms |
405588 KB |
Output is correct |
151 |
Correct |
98 ms |
405616 KB |
Output is correct |
152 |
Correct |
100 ms |
405632 KB |
Output is correct |
153 |
Correct |
99 ms |
405584 KB |
Output is correct |
154 |
Correct |
101 ms |
405568 KB |
Output is correct |
155 |
Correct |
97 ms |
405584 KB |
Output is correct |
156 |
Correct |
97 ms |
405484 KB |
Output is correct |
157 |
Correct |
1394 ms |
480356 KB |
Output is correct |
158 |
Correct |
1726 ms |
488304 KB |
Output is correct |
159 |
Correct |
1635 ms |
488572 KB |
Output is correct |
160 |
Correct |
1619 ms |
488368 KB |
Output is correct |
161 |
Correct |
1620 ms |
488520 KB |
Output is correct |
162 |
Correct |
1707 ms |
488264 KB |
Output is correct |
163 |
Correct |
1591 ms |
488352 KB |
Output is correct |
164 |
Correct |
1250 ms |
488352 KB |
Output is correct |
165 |
Correct |
1252 ms |
488284 KB |
Output is correct |
166 |
Correct |
1320 ms |
488496 KB |
Output is correct |
167 |
Correct |
1300 ms |
488276 KB |
Output is correct |
168 |
Correct |
94 ms |
404468 KB |
Output is correct |
169 |
Correct |
956 ms |
430256 KB |
Output is correct |
170 |
Correct |
1956 ms |
488232 KB |
Output is correct |
171 |
Correct |
1930 ms |
488264 KB |
Output is correct |
172 |
Correct |
2218 ms |
488144 KB |
Output is correct |
173 |
Correct |
2285 ms |
488252 KB |
Output is correct |
174 |
Correct |
2116 ms |
488368 KB |
Output is correct |
175 |
Correct |
2047 ms |
488564 KB |
Output is correct |
176 |
Correct |
1432 ms |
488356 KB |
Output is correct |
177 |
Correct |
1388 ms |
488388 KB |
Output is correct |
178 |
Correct |
1381 ms |
488568 KB |
Output is correct |
179 |
Correct |
1365 ms |
488380 KB |
Output is correct |