#include "joitour.h"
#include<bits/stdc++.h>
using namespace std;
using i32 = int;
#define int long long
const int maxn = 2e5+5;
int N,C[maxn];
vector<int> edge[maxn];
int L[maxn],R[maxn],T,ans,P[maxn];
int child[maxn],son[maxn],head[maxn],lst[maxn],par[maxn];
void pre_dfs(int u,int p){
child[u]=1;par[u]=p;
for(int v:edge[u]){
if(v==p) continue;
pre_dfs(v,u);
child[u]+=child[v];
if(child[v]>child[son[u]]) son[u]=v;
}
}
void hld_dfs(int u,int p,int t){
L[u]=++T;P[T]=u;
if(t) head[u]=head[p];
else head[u]=u;
//cout << "head " << u << ' ' << head[u] << ' ' << head[p] << '\n';
lst[head[u]]=u;
if(son[u]) hld_dfs(son[u],u,1);
for(int v:edge[u]) if(v!=p && v!=son[u]) hld_dfs(v,u,0);
R[u]=T;
}
struct Node{
int s0=0,s2=0,c0=0,c2=0;
int sum=0,total=0;
Node(int s0=0,int s2=0,int c0=0,int c2=0):s0(s0),s2(s2),c0(c0),c2(c2){
sum=c0*c2;
}
friend Node operator+(Node a,Node b){
Node res;
res.s0=a.s0+b.s0;
res.s2=a.s2+b.s2;
res.c0=a.c0+b.c0;
res.c2=a.c2+b.c2;
res.sum=a.sum+b.sum;
res.total=a.total+b.total+a.c0*b.s2+a.c2*b.s0+a.s0*b.c2+a.s2*b.c0;
return res;
};
friend Node operator-(Node a,Node b){
Node res;
res.s0=a.s0-b.s0;
res.s2=a.s2-b.s2;
res.c0=a.c0-b.c0;
res.c2=a.c2-b.c2;
res.sum=a.sum-b.sum;
res.total=a.total-b.total-(res.c0*b.s2+res.c2*b.s0+res.s0*b.c2+res.s2*b.c0);
return res;
};
}cc[maxn];
struct node{
int total=0;
int c0=0,c1=0,c2=0;
int l0=0,l2=0,r0=0,r2=0;
node(){}
friend node operator+(node a,node b){
node res;
res.c0=a.c0+b.c0;
res.c1=a.c1+b.c1;
res.c2=a.c2+b.c2;
res.l0=a.l0+b.l0+a.c0*b.c1;
res.l2=a.l2+b.l2+a.c2*b.c1;
res.r0=a.r0+b.r0+a.c1*b.c0;
res.r2=a.r2+b.r2+a.c1*b.c2;
res.total=a.total+b.total+a.l0*b.c2+a.l2*b.c0+a.c0*b.r2+a.c2*b.r0;
return res;
}
}tree[4*maxn];
node query(int l,int r,int id,int tl,int tr){
if(tr<l || r<tl) return node();
if(tl<=l && r<=tr) return tree[id];
int mid=(l+r)>>1;
return query(l,mid,id<<1,tl,tr)+query(mid+1,r,id<<1|1,tl,tr);
}
void update(int l,int r,int id,int p,node val){
if(l==r){
tree[id]=val;
return;
}
int mid=(l+r)>>1;
if(p<=mid) update(l,mid,id<<1,p,val);
else update(mid+1,r,id<<1|1,p,val);
tree[id]=tree[id<<1]+tree[id<<1|1];
}
void change(i32 u, i32 d) {
//cout << "change " << u << ' ' << d << '\n';
u++;C[u]=d;
while(u){
int v=head[u],w=lst[v],p=par[v];
//cout << u << ' ' << v << ' ' << w << '\n';
node cur=query(1,N,1,L[v],L[w]);
ans-=cur.total;
if(p) cc[p]=cc[p]-Node(cur.r0,cur.r2,cur.c0,cur.c2);
node val;
val.total=cc[u].total;
val.l0=val.r0=cc[u].s0;
val.l2=val.r2=cc[u].s2;
val.c0=cc[u].c0;
val.c2=cc[u].c2;
node add;
if(C[u]==0) add.c0++;
else if(C[u]==2) add.c2++;
else{
add.c1++;
add.total+=cc[u].c0*cc[u].c2-cc[u].sum;
}
val=val+add;
//cout << val.c0 << ' ' << val.c1 << ' ' << val.c2 << ' ' << val.l0 << ' ' << val.l2 << ' ' << val.r0 << ' ' << val.r2 << ' ' << val.total << '\n';
val.l0=val.r0=max(val.l0,val.r0);
val.l2=val.r2=max(val.l2,val.r2);
update(1,N,1,L[u],val);
cur=query(1,N,1,L[v],L[w]);
ans+=cur.total;
if(p) cc[p]=cc[p]+Node(cur.r0,cur.r2,cur.c0,cur.c2);
u=p;
}
}
void init(i32 _N, std::vector<i32> F, std::vector<i32> U, std::vector<i32> V,
i32 Q) {
N=_N;
for(int i=0;i<N-1;i++){
U[i]++;V[i]++;
edge[U[i]].push_back(V[i]);
edge[V[i]].push_back(U[i]);
}
pre_dfs(1,0);
hld_dfs(1,0,0);
for(int i=1;i<=N;i++){
int u=P[i];
change(u-1,F[u-1]);
}
}
long long num_tours() {
return ans;
}
#undef int
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
76376 KB |
Output is correct |
2 |
Correct |
9 ms |
76376 KB |
Output is correct |
3 |
Correct |
9 ms |
76376 KB |
Output is correct |
4 |
Correct |
9 ms |
76420 KB |
Output is correct |
5 |
Correct |
10 ms |
76628 KB |
Output is correct |
6 |
Correct |
10 ms |
76376 KB |
Output is correct |
7 |
Correct |
10 ms |
76376 KB |
Output is correct |
8 |
Correct |
10 ms |
76376 KB |
Output is correct |
9 |
Correct |
11 ms |
76376 KB |
Output is correct |
10 |
Correct |
10 ms |
76472 KB |
Output is correct |
11 |
Correct |
9 ms |
76376 KB |
Output is correct |
12 |
Correct |
9 ms |
76376 KB |
Output is correct |
13 |
Correct |
8 ms |
76376 KB |
Output is correct |
14 |
Correct |
9 ms |
76376 KB |
Output is correct |
15 |
Correct |
10 ms |
76376 KB |
Output is correct |
16 |
Correct |
9 ms |
76480 KB |
Output is correct |
17 |
Correct |
10 ms |
76376 KB |
Output is correct |
18 |
Correct |
10 ms |
76376 KB |
Output is correct |
19 |
Correct |
10 ms |
76376 KB |
Output is correct |
20 |
Correct |
10 ms |
76376 KB |
Output is correct |
21 |
Correct |
10 ms |
76424 KB |
Output is correct |
22 |
Correct |
9 ms |
76376 KB |
Output is correct |
23 |
Correct |
9 ms |
76488 KB |
Output is correct |
24 |
Correct |
10 ms |
76376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
76376 KB |
Output is correct |
2 |
Correct |
9 ms |
76376 KB |
Output is correct |
3 |
Correct |
9 ms |
76376 KB |
Output is correct |
4 |
Correct |
9 ms |
76420 KB |
Output is correct |
5 |
Correct |
10 ms |
76628 KB |
Output is correct |
6 |
Correct |
10 ms |
76376 KB |
Output is correct |
7 |
Correct |
10 ms |
76376 KB |
Output is correct |
8 |
Correct |
10 ms |
76376 KB |
Output is correct |
9 |
Correct |
11 ms |
76376 KB |
Output is correct |
10 |
Correct |
10 ms |
76472 KB |
Output is correct |
11 |
Correct |
9 ms |
76376 KB |
Output is correct |
12 |
Correct |
9 ms |
76376 KB |
Output is correct |
13 |
Correct |
8 ms |
76376 KB |
Output is correct |
14 |
Correct |
9 ms |
76376 KB |
Output is correct |
15 |
Correct |
10 ms |
76376 KB |
Output is correct |
16 |
Correct |
9 ms |
76480 KB |
Output is correct |
17 |
Correct |
10 ms |
76376 KB |
Output is correct |
18 |
Correct |
10 ms |
76376 KB |
Output is correct |
19 |
Correct |
10 ms |
76376 KB |
Output is correct |
20 |
Correct |
10 ms |
76376 KB |
Output is correct |
21 |
Correct |
10 ms |
76424 KB |
Output is correct |
22 |
Correct |
9 ms |
76376 KB |
Output is correct |
23 |
Correct |
9 ms |
76488 KB |
Output is correct |
24 |
Correct |
10 ms |
76376 KB |
Output is correct |
25 |
Correct |
18 ms |
76888 KB |
Output is correct |
26 |
Correct |
22 ms |
76632 KB |
Output is correct |
27 |
Correct |
19 ms |
76628 KB |
Output is correct |
28 |
Correct |
16 ms |
76888 KB |
Output is correct |
29 |
Correct |
26 ms |
76632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
76376 KB |
Output is correct |
2 |
Correct |
327 ms |
96964 KB |
Output is correct |
3 |
Correct |
356 ms |
96780 KB |
Output is correct |
4 |
Correct |
339 ms |
94544 KB |
Output is correct |
5 |
Correct |
304 ms |
97544 KB |
Output is correct |
6 |
Correct |
962 ms |
90704 KB |
Output is correct |
7 |
Correct |
964 ms |
90940 KB |
Output is correct |
8 |
Correct |
990 ms |
91204 KB |
Output is correct |
9 |
Correct |
937 ms |
91420 KB |
Output is correct |
10 |
Correct |
950 ms |
91728 KB |
Output is correct |
11 |
Correct |
740 ms |
92420 KB |
Output is correct |
12 |
Correct |
350 ms |
94728 KB |
Output is correct |
13 |
Correct |
352 ms |
94724 KB |
Output is correct |
14 |
Correct |
372 ms |
94476 KB |
Output is correct |
15 |
Correct |
383 ms |
94036 KB |
Output is correct |
16 |
Correct |
282 ms |
99408 KB |
Output is correct |
17 |
Correct |
9 ms |
76376 KB |
Output is correct |
18 |
Correct |
9 ms |
76376 KB |
Output is correct |
19 |
Correct |
9 ms |
76376 KB |
Output is correct |
20 |
Correct |
9 ms |
76376 KB |
Output is correct |
21 |
Correct |
710 ms |
90624 KB |
Output is correct |
22 |
Correct |
669 ms |
90704 KB |
Output is correct |
23 |
Correct |
650 ms |
90824 KB |
Output is correct |
24 |
Correct |
677 ms |
90908 KB |
Output is correct |
25 |
Correct |
325 ms |
91016 KB |
Output is correct |
26 |
Correct |
321 ms |
91000 KB |
Output is correct |
27 |
Correct |
313 ms |
91076 KB |
Output is correct |
28 |
Correct |
329 ms |
90996 KB |
Output is correct |
29 |
Correct |
116 ms |
102104 KB |
Output is correct |
30 |
Correct |
117 ms |
102148 KB |
Output is correct |
31 |
Correct |
115 ms |
101964 KB |
Output is correct |
32 |
Correct |
155 ms |
101968 KB |
Output is correct |
33 |
Correct |
977 ms |
91216 KB |
Output is correct |
34 |
Correct |
979 ms |
91116 KB |
Output is correct |
35 |
Correct |
955 ms |
91160 KB |
Output is correct |
36 |
Correct |
987 ms |
91112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
76376 KB |
Output is correct |
2 |
Correct |
10 ms |
76492 KB |
Output is correct |
3 |
Correct |
9 ms |
76436 KB |
Output is correct |
4 |
Correct |
10 ms |
76376 KB |
Output is correct |
5 |
Correct |
9 ms |
76476 KB |
Output is correct |
6 |
Correct |
9 ms |
76420 KB |
Output is correct |
7 |
Correct |
10 ms |
76376 KB |
Output is correct |
8 |
Correct |
16 ms |
76888 KB |
Output is correct |
9 |
Correct |
159 ms |
102148 KB |
Output is correct |
10 |
Correct |
113 ms |
101968 KB |
Output is correct |
11 |
Correct |
154 ms |
102060 KB |
Output is correct |
12 |
Correct |
120 ms |
102156 KB |
Output is correct |
13 |
Correct |
227 ms |
89168 KB |
Output is correct |
14 |
Correct |
209 ms |
89168 KB |
Output is correct |
15 |
Correct |
243 ms |
89216 KB |
Output is correct |
16 |
Correct |
233 ms |
89052 KB |
Output is correct |
17 |
Correct |
240 ms |
89168 KB |
Output is correct |
18 |
Correct |
231 ms |
89268 KB |
Output is correct |
19 |
Correct |
452 ms |
101968 KB |
Output is correct |
20 |
Correct |
420 ms |
102148 KB |
Output is correct |
21 |
Correct |
506 ms |
102068 KB |
Output is correct |
22 |
Correct |
480 ms |
102148 KB |
Output is correct |
23 |
Correct |
443 ms |
102120 KB |
Output is correct |
24 |
Correct |
465 ms |
102156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
76376 KB |
Output is correct |
2 |
Correct |
10 ms |
76376 KB |
Output is correct |
3 |
Correct |
9 ms |
76376 KB |
Output is correct |
4 |
Correct |
9 ms |
76440 KB |
Output is correct |
5 |
Correct |
9 ms |
76488 KB |
Output is correct |
6 |
Correct |
10 ms |
76376 KB |
Output is correct |
7 |
Correct |
29 ms |
76888 KB |
Output is correct |
8 |
Correct |
936 ms |
91344 KB |
Output is correct |
9 |
Correct |
933 ms |
91400 KB |
Output is correct |
10 |
Correct |
949 ms |
91216 KB |
Output is correct |
11 |
Correct |
938 ms |
91216 KB |
Output is correct |
12 |
Correct |
660 ms |
83792 KB |
Output is correct |
13 |
Correct |
768 ms |
83668 KB |
Output is correct |
14 |
Correct |
740 ms |
84048 KB |
Output is correct |
15 |
Correct |
773 ms |
83800 KB |
Output is correct |
16 |
Correct |
747 ms |
83588 KB |
Output is correct |
17 |
Correct |
750 ms |
83792 KB |
Output is correct |
18 |
Correct |
1377 ms |
91356 KB |
Output is correct |
19 |
Correct |
1632 ms |
91216 KB |
Output is correct |
20 |
Correct |
1665 ms |
90996 KB |
Output is correct |
21 |
Correct |
1649 ms |
91472 KB |
Output is correct |
22 |
Correct |
1602 ms |
91216 KB |
Output is correct |
23 |
Correct |
1622 ms |
91096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
76376 KB |
Output is correct |
2 |
Correct |
9 ms |
76376 KB |
Output is correct |
3 |
Correct |
9 ms |
76376 KB |
Output is correct |
4 |
Correct |
9 ms |
76420 KB |
Output is correct |
5 |
Correct |
10 ms |
76628 KB |
Output is correct |
6 |
Correct |
10 ms |
76376 KB |
Output is correct |
7 |
Correct |
10 ms |
76376 KB |
Output is correct |
8 |
Correct |
10 ms |
76376 KB |
Output is correct |
9 |
Correct |
11 ms |
76376 KB |
Output is correct |
10 |
Correct |
10 ms |
76472 KB |
Output is correct |
11 |
Correct |
9 ms |
76376 KB |
Output is correct |
12 |
Correct |
9 ms |
76376 KB |
Output is correct |
13 |
Correct |
8 ms |
76376 KB |
Output is correct |
14 |
Correct |
9 ms |
76376 KB |
Output is correct |
15 |
Correct |
10 ms |
76376 KB |
Output is correct |
16 |
Correct |
9 ms |
76480 KB |
Output is correct |
17 |
Correct |
10 ms |
76376 KB |
Output is correct |
18 |
Correct |
10 ms |
76376 KB |
Output is correct |
19 |
Correct |
10 ms |
76376 KB |
Output is correct |
20 |
Correct |
10 ms |
76376 KB |
Output is correct |
21 |
Correct |
10 ms |
76424 KB |
Output is correct |
22 |
Correct |
9 ms |
76376 KB |
Output is correct |
23 |
Correct |
9 ms |
76488 KB |
Output is correct |
24 |
Correct |
10 ms |
76376 KB |
Output is correct |
25 |
Correct |
18 ms |
76888 KB |
Output is correct |
26 |
Correct |
22 ms |
76632 KB |
Output is correct |
27 |
Correct |
19 ms |
76628 KB |
Output is correct |
28 |
Correct |
16 ms |
76888 KB |
Output is correct |
29 |
Correct |
26 ms |
76632 KB |
Output is correct |
30 |
Correct |
341 ms |
85176 KB |
Output is correct |
31 |
Correct |
330 ms |
86096 KB |
Output is correct |
32 |
Correct |
360 ms |
86140 KB |
Output is correct |
33 |
Correct |
333 ms |
86656 KB |
Output is correct |
34 |
Correct |
339 ms |
86860 KB |
Output is correct |
35 |
Correct |
369 ms |
85972 KB |
Output is correct |
36 |
Correct |
769 ms |
83536 KB |
Output is correct |
37 |
Correct |
767 ms |
83796 KB |
Output is correct |
38 |
Correct |
737 ms |
83544 KB |
Output is correct |
39 |
Correct |
724 ms |
83896 KB |
Output is correct |
40 |
Correct |
682 ms |
83880 KB |
Output is correct |
41 |
Correct |
604 ms |
84304 KB |
Output is correct |
42 |
Correct |
381 ms |
85580 KB |
Output is correct |
43 |
Correct |
416 ms |
84620 KB |
Output is correct |
44 |
Correct |
420 ms |
85072 KB |
Output is correct |
45 |
Correct |
357 ms |
85360 KB |
Output is correct |
46 |
Correct |
424 ms |
84964 KB |
Output is correct |
47 |
Correct |
379 ms |
85584 KB |
Output is correct |
48 |
Correct |
305 ms |
86384 KB |
Output is correct |
49 |
Correct |
309 ms |
87872 KB |
Output is correct |
50 |
Correct |
371 ms |
86184 KB |
Output is correct |
51 |
Correct |
469 ms |
83568 KB |
Output is correct |
52 |
Correct |
602 ms |
83536 KB |
Output is correct |
53 |
Correct |
601 ms |
83572 KB |
Output is correct |
54 |
Correct |
549 ms |
83568 KB |
Output is correct |
55 |
Correct |
583 ms |
83416 KB |
Output is correct |
56 |
Correct |
588 ms |
83572 KB |
Output is correct |
57 |
Correct |
341 ms |
83696 KB |
Output is correct |
58 |
Correct |
376 ms |
83680 KB |
Output is correct |
59 |
Correct |
362 ms |
83652 KB |
Output is correct |
60 |
Correct |
340 ms |
83808 KB |
Output is correct |
61 |
Correct |
349 ms |
83800 KB |
Output is correct |
62 |
Correct |
234 ms |
89212 KB |
Output is correct |
63 |
Correct |
183 ms |
89096 KB |
Output is correct |
64 |
Correct |
225 ms |
89176 KB |
Output is correct |
65 |
Correct |
286 ms |
89212 KB |
Output is correct |
66 |
Correct |
267 ms |
89220 KB |
Output is correct |
67 |
Correct |
220 ms |
89168 KB |
Output is correct |
68 |
Correct |
709 ms |
83564 KB |
Output is correct |
69 |
Correct |
794 ms |
83584 KB |
Output is correct |
70 |
Correct |
769 ms |
83792 KB |
Output is correct |
71 |
Correct |
811 ms |
83792 KB |
Output is correct |
72 |
Correct |
772 ms |
83800 KB |
Output is correct |
73 |
Correct |
751 ms |
83796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
76376 KB |
Output is correct |
2 |
Correct |
9 ms |
76376 KB |
Output is correct |
3 |
Correct |
9 ms |
76376 KB |
Output is correct |
4 |
Correct |
9 ms |
76420 KB |
Output is correct |
5 |
Correct |
10 ms |
76628 KB |
Output is correct |
6 |
Correct |
10 ms |
76376 KB |
Output is correct |
7 |
Correct |
10 ms |
76376 KB |
Output is correct |
8 |
Correct |
10 ms |
76376 KB |
Output is correct |
9 |
Correct |
11 ms |
76376 KB |
Output is correct |
10 |
Correct |
10 ms |
76472 KB |
Output is correct |
11 |
Correct |
9 ms |
76376 KB |
Output is correct |
12 |
Correct |
9 ms |
76376 KB |
Output is correct |
13 |
Correct |
8 ms |
76376 KB |
Output is correct |
14 |
Correct |
9 ms |
76376 KB |
Output is correct |
15 |
Correct |
10 ms |
76376 KB |
Output is correct |
16 |
Correct |
9 ms |
76480 KB |
Output is correct |
17 |
Correct |
10 ms |
76376 KB |
Output is correct |
18 |
Correct |
10 ms |
76376 KB |
Output is correct |
19 |
Correct |
10 ms |
76376 KB |
Output is correct |
20 |
Correct |
10 ms |
76376 KB |
Output is correct |
21 |
Correct |
10 ms |
76424 KB |
Output is correct |
22 |
Correct |
9 ms |
76376 KB |
Output is correct |
23 |
Correct |
9 ms |
76488 KB |
Output is correct |
24 |
Correct |
10 ms |
76376 KB |
Output is correct |
25 |
Correct |
18 ms |
76888 KB |
Output is correct |
26 |
Correct |
22 ms |
76632 KB |
Output is correct |
27 |
Correct |
19 ms |
76628 KB |
Output is correct |
28 |
Correct |
16 ms |
76888 KB |
Output is correct |
29 |
Correct |
26 ms |
76632 KB |
Output is correct |
30 |
Correct |
8 ms |
76376 KB |
Output is correct |
31 |
Correct |
327 ms |
96964 KB |
Output is correct |
32 |
Correct |
356 ms |
96780 KB |
Output is correct |
33 |
Correct |
339 ms |
94544 KB |
Output is correct |
34 |
Correct |
304 ms |
97544 KB |
Output is correct |
35 |
Correct |
962 ms |
90704 KB |
Output is correct |
36 |
Correct |
964 ms |
90940 KB |
Output is correct |
37 |
Correct |
990 ms |
91204 KB |
Output is correct |
38 |
Correct |
937 ms |
91420 KB |
Output is correct |
39 |
Correct |
950 ms |
91728 KB |
Output is correct |
40 |
Correct |
740 ms |
92420 KB |
Output is correct |
41 |
Correct |
350 ms |
94728 KB |
Output is correct |
42 |
Correct |
352 ms |
94724 KB |
Output is correct |
43 |
Correct |
372 ms |
94476 KB |
Output is correct |
44 |
Correct |
383 ms |
94036 KB |
Output is correct |
45 |
Correct |
282 ms |
99408 KB |
Output is correct |
46 |
Correct |
9 ms |
76376 KB |
Output is correct |
47 |
Correct |
9 ms |
76376 KB |
Output is correct |
48 |
Correct |
9 ms |
76376 KB |
Output is correct |
49 |
Correct |
9 ms |
76376 KB |
Output is correct |
50 |
Correct |
710 ms |
90624 KB |
Output is correct |
51 |
Correct |
669 ms |
90704 KB |
Output is correct |
52 |
Correct |
650 ms |
90824 KB |
Output is correct |
53 |
Correct |
677 ms |
90908 KB |
Output is correct |
54 |
Correct |
325 ms |
91016 KB |
Output is correct |
55 |
Correct |
321 ms |
91000 KB |
Output is correct |
56 |
Correct |
313 ms |
91076 KB |
Output is correct |
57 |
Correct |
329 ms |
90996 KB |
Output is correct |
58 |
Correct |
116 ms |
102104 KB |
Output is correct |
59 |
Correct |
117 ms |
102148 KB |
Output is correct |
60 |
Correct |
115 ms |
101964 KB |
Output is correct |
61 |
Correct |
155 ms |
101968 KB |
Output is correct |
62 |
Correct |
977 ms |
91216 KB |
Output is correct |
63 |
Correct |
979 ms |
91116 KB |
Output is correct |
64 |
Correct |
955 ms |
91160 KB |
Output is correct |
65 |
Correct |
987 ms |
91112 KB |
Output is correct |
66 |
Correct |
9 ms |
76376 KB |
Output is correct |
67 |
Correct |
10 ms |
76492 KB |
Output is correct |
68 |
Correct |
9 ms |
76436 KB |
Output is correct |
69 |
Correct |
10 ms |
76376 KB |
Output is correct |
70 |
Correct |
9 ms |
76476 KB |
Output is correct |
71 |
Correct |
9 ms |
76420 KB |
Output is correct |
72 |
Correct |
10 ms |
76376 KB |
Output is correct |
73 |
Correct |
16 ms |
76888 KB |
Output is correct |
74 |
Correct |
159 ms |
102148 KB |
Output is correct |
75 |
Correct |
113 ms |
101968 KB |
Output is correct |
76 |
Correct |
154 ms |
102060 KB |
Output is correct |
77 |
Correct |
120 ms |
102156 KB |
Output is correct |
78 |
Correct |
227 ms |
89168 KB |
Output is correct |
79 |
Correct |
209 ms |
89168 KB |
Output is correct |
80 |
Correct |
243 ms |
89216 KB |
Output is correct |
81 |
Correct |
233 ms |
89052 KB |
Output is correct |
82 |
Correct |
240 ms |
89168 KB |
Output is correct |
83 |
Correct |
231 ms |
89268 KB |
Output is correct |
84 |
Correct |
452 ms |
101968 KB |
Output is correct |
85 |
Correct |
420 ms |
102148 KB |
Output is correct |
86 |
Correct |
506 ms |
102068 KB |
Output is correct |
87 |
Correct |
480 ms |
102148 KB |
Output is correct |
88 |
Correct |
443 ms |
102120 KB |
Output is correct |
89 |
Correct |
465 ms |
102156 KB |
Output is correct |
90 |
Correct |
9 ms |
76376 KB |
Output is correct |
91 |
Correct |
10 ms |
76376 KB |
Output is correct |
92 |
Correct |
9 ms |
76376 KB |
Output is correct |
93 |
Correct |
9 ms |
76440 KB |
Output is correct |
94 |
Correct |
9 ms |
76488 KB |
Output is correct |
95 |
Correct |
10 ms |
76376 KB |
Output is correct |
96 |
Correct |
29 ms |
76888 KB |
Output is correct |
97 |
Correct |
936 ms |
91344 KB |
Output is correct |
98 |
Correct |
933 ms |
91400 KB |
Output is correct |
99 |
Correct |
949 ms |
91216 KB |
Output is correct |
100 |
Correct |
938 ms |
91216 KB |
Output is correct |
101 |
Correct |
660 ms |
83792 KB |
Output is correct |
102 |
Correct |
768 ms |
83668 KB |
Output is correct |
103 |
Correct |
740 ms |
84048 KB |
Output is correct |
104 |
Correct |
773 ms |
83800 KB |
Output is correct |
105 |
Correct |
747 ms |
83588 KB |
Output is correct |
106 |
Correct |
750 ms |
83792 KB |
Output is correct |
107 |
Correct |
1377 ms |
91356 KB |
Output is correct |
108 |
Correct |
1632 ms |
91216 KB |
Output is correct |
109 |
Correct |
1665 ms |
90996 KB |
Output is correct |
110 |
Correct |
1649 ms |
91472 KB |
Output is correct |
111 |
Correct |
1602 ms |
91216 KB |
Output is correct |
112 |
Correct |
1622 ms |
91096 KB |
Output is correct |
113 |
Correct |
341 ms |
85176 KB |
Output is correct |
114 |
Correct |
330 ms |
86096 KB |
Output is correct |
115 |
Correct |
360 ms |
86140 KB |
Output is correct |
116 |
Correct |
333 ms |
86656 KB |
Output is correct |
117 |
Correct |
339 ms |
86860 KB |
Output is correct |
118 |
Correct |
369 ms |
85972 KB |
Output is correct |
119 |
Correct |
769 ms |
83536 KB |
Output is correct |
120 |
Correct |
767 ms |
83796 KB |
Output is correct |
121 |
Correct |
737 ms |
83544 KB |
Output is correct |
122 |
Correct |
724 ms |
83896 KB |
Output is correct |
123 |
Correct |
682 ms |
83880 KB |
Output is correct |
124 |
Correct |
604 ms |
84304 KB |
Output is correct |
125 |
Correct |
381 ms |
85580 KB |
Output is correct |
126 |
Correct |
416 ms |
84620 KB |
Output is correct |
127 |
Correct |
420 ms |
85072 KB |
Output is correct |
128 |
Correct |
357 ms |
85360 KB |
Output is correct |
129 |
Correct |
424 ms |
84964 KB |
Output is correct |
130 |
Correct |
379 ms |
85584 KB |
Output is correct |
131 |
Correct |
305 ms |
86384 KB |
Output is correct |
132 |
Correct |
309 ms |
87872 KB |
Output is correct |
133 |
Correct |
371 ms |
86184 KB |
Output is correct |
134 |
Correct |
469 ms |
83568 KB |
Output is correct |
135 |
Correct |
602 ms |
83536 KB |
Output is correct |
136 |
Correct |
601 ms |
83572 KB |
Output is correct |
137 |
Correct |
549 ms |
83568 KB |
Output is correct |
138 |
Correct |
583 ms |
83416 KB |
Output is correct |
139 |
Correct |
588 ms |
83572 KB |
Output is correct |
140 |
Correct |
341 ms |
83696 KB |
Output is correct |
141 |
Correct |
376 ms |
83680 KB |
Output is correct |
142 |
Correct |
362 ms |
83652 KB |
Output is correct |
143 |
Correct |
340 ms |
83808 KB |
Output is correct |
144 |
Correct |
349 ms |
83800 KB |
Output is correct |
145 |
Correct |
234 ms |
89212 KB |
Output is correct |
146 |
Correct |
183 ms |
89096 KB |
Output is correct |
147 |
Correct |
225 ms |
89176 KB |
Output is correct |
148 |
Correct |
286 ms |
89212 KB |
Output is correct |
149 |
Correct |
267 ms |
89220 KB |
Output is correct |
150 |
Correct |
220 ms |
89168 KB |
Output is correct |
151 |
Correct |
709 ms |
83564 KB |
Output is correct |
152 |
Correct |
794 ms |
83584 KB |
Output is correct |
153 |
Correct |
769 ms |
83792 KB |
Output is correct |
154 |
Correct |
811 ms |
83792 KB |
Output is correct |
155 |
Correct |
772 ms |
83800 KB |
Output is correct |
156 |
Correct |
751 ms |
83796 KB |
Output is correct |
157 |
Correct |
709 ms |
95824 KB |
Output is correct |
158 |
Correct |
688 ms |
97100 KB |
Output is correct |
159 |
Correct |
764 ms |
95496 KB |
Output is correct |
160 |
Correct |
708 ms |
94680 KB |
Output is correct |
161 |
Correct |
662 ms |
97516 KB |
Output is correct |
162 |
Correct |
740 ms |
97104 KB |
Output is correct |
163 |
Correct |
1707 ms |
90936 KB |
Output is correct |
164 |
Correct |
1652 ms |
90840 KB |
Output is correct |
165 |
Correct |
1696 ms |
91212 KB |
Output is correct |
166 |
Correct |
1615 ms |
91428 KB |
Output is correct |
167 |
Correct |
1560 ms |
91984 KB |
Output is correct |
168 |
Correct |
1365 ms |
92496 KB |
Output is correct |
169 |
Correct |
699 ms |
94544 KB |
Output is correct |
170 |
Correct |
843 ms |
93880 KB |
Output is correct |
171 |
Correct |
796 ms |
93964 KB |
Output is correct |
172 |
Correct |
824 ms |
93400 KB |
Output is correct |
173 |
Correct |
816 ms |
94220 KB |
Output is correct |
174 |
Correct |
853 ms |
94836 KB |
Output is correct |
175 |
Correct |
686 ms |
96728 KB |
Output is correct |
176 |
Correct |
625 ms |
98912 KB |
Output is correct |
177 |
Correct |
635 ms |
101640 KB |
Output is correct |
178 |
Correct |
1142 ms |
90732 KB |
Output is correct |
179 |
Correct |
1315 ms |
90564 KB |
Output is correct |
180 |
Correct |
1292 ms |
90704 KB |
Output is correct |
181 |
Correct |
1230 ms |
90780 KB |
Output is correct |
182 |
Correct |
1281 ms |
90764 KB |
Output is correct |
183 |
Correct |
1272 ms |
90632 KB |
Output is correct |
184 |
Correct |
717 ms |
91248 KB |
Output is correct |
185 |
Correct |
780 ms |
91204 KB |
Output is correct |
186 |
Correct |
763 ms |
91016 KB |
Output is correct |
187 |
Correct |
793 ms |
91208 KB |
Output is correct |
188 |
Correct |
791 ms |
91248 KB |
Output is correct |