답안 #292877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292877 2020-09-07T14:33:00 Z 최은수(#5797) 서류 전달 (ROI16_sending) C++17
100 / 100
2286 ms 96176 KB
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e8+7;
const ll INF=1e18;
const int mx=200010;
int dep[mx];
int spa[mx][18];
inline int kpa(int x,int k)
{
    for(;k>0;k^=k&-k)
        x=spa[x][__builtin_ctz(k)];
    return x;
}
inline int lca(int x,int y)
{
    if(dep[x]>dep[y])
        x=kpa(x,dep[x]-dep[y]);
    else
        y=kpa(y,dep[y]-dep[x]);
    if(x==y)
        return x;
    for(int i=18;i-->0;)
        if(spa[x][i]!=spa[y][i])
            x=spa[x][i],y=spa[y][i];
    return spa[x][0];
}
vector<int>adj[mx];
int inord[mx],outord[mx];
int ordct;
void dfs(int x,int p)
{
    inord[x]=++ordct;
    dep[x]=dep[spa[x][0]=p]+1;
    for(int i=0;i<17;i++)
        spa[x][i+1]=spa[spa[x][i]][i];
    for(int&t:adj[x])
        dfs(t,x);
    outord[x]=ordct;
    return;
}
map<int,vector<int> >mp[mx];
vector<int>vv[mx];
pi qry[mx];
int lc[mx];
int ansv=0,ansi=1,ansj=2;
pi mn1[mx],mn2[mx];
inline void upd(int x,pi v)
{
    if(v<mn1[x])
        mn2[x]=mn1[x],mn1[x]=v;
    else if(v<mn2[x])
        mn2[x]=v;
    return;
}
void dfs2(int x)
{
    mn1[x]=pi(inf,0);
    mn2[x]=pi(inf,0);
    for(int&t:vv[x])
        upd(x,pi(dep[lc[t]],t));
    for(int&t:adj[x])
        dfs2(t),upd(x,mn1[t]),upd(x,mn2[t]);
    if(dep[x]-mn2[x].fi>ansv)
        ansv=dep[x]-mn2[x].fi,ansi=mn1[x].se,ansj=mn2[x].se;
    return;
}
vector<pi>adj2[mx];
bool chk[mx];
int siz[mx];
void cdfs0(int x,int p)
{
    siz[x]=1;
    for(pi&t:adj2[x])
        if(t.fi!=p)
            cdfs0(t.fi,x),siz[x]+=siz[t.fi];
    return;
}
int cdis[mx][18];
void cdfs(int x,int p,int d,int cd,vector<int>&v,bool push)
{
    if(push)
        v.eb(x);
    cdis[x][cd]=d;
    siz[x]=1;
    for(pi&t:adj2[x])
        if(!chk[t.fi]&&t.fi!=p)
            cdfs(t.fi,x,d+t.se,cd,v,push),siz[x]+=siz[t.fi];
    return;
}
int cent(int x,int p,int sz)
{
    int ms=-1,mi=-1;
    for(pi&t:adj2[x])
        if(!chk[t.fi]&&t.fi!=p&&siz[t.fi]>ms)
            ms=siz[t.fi],mi=t.fi;
    if(ms<=sz)
        return x;
    return cent(mi,x,sz);
}
int cpa[mx],cdep[mx];
void dnc(int x,bool push)
{
    chk[x]=1;
    if(push)
        vv[x].eb(x);
    cdis[x][cdep[x]]=0;
    for(pi&t:adj2[x])
    {
        if(chk[t.fi])
            continue;
        cdfs(t.fi,x,t.se,cdep[x],vv[x],push);
        int nc=cent(t.fi,x,siz[t.fi]/2);
        cpa[nc]=x;
        cdep[nc]=cdep[x]+1;
        dnc(nc,push);
    }
    return;
}
vector<int>vert[mx];
pi mxv[mx];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin>>n>>k;
    for(int i=1;i++<n;)
    {
        int p;
        cin>>p;
        adj[p].eb(i);
    }
    dfs(1,0);
    for(int i=0;i++<k;)
    {
        cin>>qry[i].fi>>qry[i].se;
        const int&l=lc[i]=lca(qry[i].fi,qry[i].se);
        if(qry[i].fi!=l&&qry[i].se!=l)
        {
            int l1=kpa(qry[i].fi,dep[qry[i].fi]-dep[l]-1);
            int l2=kpa(qry[i].se,dep[qry[i].se]-dep[l]-1);
            if(l1>l2)
                swap(l1,l2),swap(qry[i].fi,qry[i].se);
            mp[l1][l2].eb(i);
        }
        if(qry[i].fi!=l)
            vv[qry[i].fi].eb(i);
        if(qry[i].se!=l)
            vv[qry[i].se].eb(i);
    }
    dfs2(1);
    for(int i=0;i++<n;)
        adj[i].clear(),vv[i].clear();
    auto cmp=[&](const int&x,const int&y)->bool{return inord[x]<inord[y];};
    for(int i=0;i++<n;)
    {
        const int rt=spa[i][0];
        for(const auto&tv:mp[i])
        {
            if((int)tv.se.size()<2)
                continue;
            const vector<int>&v=tv.se;
            vector<int>v1,v2;
            for(const int&t:v)
                v1.eb(qry[t].fi),v2.eb(qry[t].se);
            {
                sort(all(v1),cmp);
                int cn=v1.size();
                for(int i=1;i<cn;i++)
                    v1.eb(lca(v1[i-1],v1[i]));
                sort(all(v1),cmp);
                v1.erase(unique(all(v1)),v1.end());
                vector<int>stk;
                for(int&t:v1)
                {
                    while(!stk.empty()&&outord[stk.back()]<inord[t])
                        stk.pop_back();
                    if(!stk.empty())
                    {
                        int u=stk.back();
                        int w=dep[t]-dep[u];
                        adj2[t].eb(u,w);
                        adj2[u].eb(t,w);
                    }
                    stk.eb(t);
                }
            }
            {
                sort(all(v2),cmp);
                int cn=v2.size();
                for(int i=1;i<cn;i++)
                    v2.eb(lca(v2[i-1],v2[i]));
                sort(all(v2),cmp);
                v2.erase(unique(all(v2)),v2.end());
                vector<int>stk;
                for(int&t:v2)
                {
                    while(!stk.empty()&&outord[stk.back()]<inord[t])
                        stk.pop_back();
                    if(!stk.empty())
                    {
                        int u=stk.back();
                        int w=dep[t]-dep[u];
                        adj2[t].eb(u,w);
                        adj2[u].eb(t,w);
                    }
                    stk.eb(t);
                }
            }
            {
                cdfs0(v1[0],0);
                int cc=cent(v1[0],0,siz[v1[0]]/2);
                cdep[cc]=cpa[cc]=0;
                dnc(cc,1);
            }
            {
                cdfs0(v2[0],0);
                int cc=cent(v2[0],0,siz[v2[0]]/2);
                cdep[cc]=cpa[cc]=0;
                dnc(cc,0);
            }
            for(int&t:v2)
                mxv[t].fi=-inf;
            for(const int&t:v)
                vert[qry[t].fi].eb(t);
            for(int&u0:v1)
            {
                int cd1=cdep[u0];
                for(int&vvv:vv[u0])
                {
                    for(int&vv0:vert[vvv])
                    {
                        int u1=qry[vv0].fi;
                        int u2=qry[vv0].se;
                        int cur=u2;
                        while(cur>0)
                        {
                            int part=dep[u1]+dep[u2]-2*dep[rt]-cdis[u1][cd1]-cdis[u2][cdep[cur]];
                            if((part+mxv[cur].fi)/2>ansv)
                                ansv=(part+mxv[cur].fi)/2,ansi=vv0,ansj=mxv[cur].se;
                            mxv[cur]=max(mxv[cur],pi(part,vv0));
                            cur=cpa[cur];
                        }
                    }
                }
                for(int&vvv:vv[u0])
                    for(int&vv0:vert[vvv])
                        for(int cur=qry[vv0].se;cur>0;cur=cpa[cur])
                            mxv[cur].fi=-inf;
            }
            for(int&t:v1)
                adj2[t].clear(),vv[t].clear(),vert[t].clear(),chk[t]=0;
            for(int&t:v2)
                adj2[t].clear(),chk[t]=0;
        }
    }
    cout<<ansv<<endl;
    cout<<ansi<<' '<<ansj<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 28544 KB Output is correct
2 Correct 19 ms 28544 KB Output is correct
3 Correct 19 ms 28544 KB Output is correct
4 Correct 19 ms 28544 KB Output is correct
5 Correct 20 ms 28544 KB Output is correct
6 Correct 19 ms 28672 KB Output is correct
7 Correct 21 ms 28672 KB Output is correct
8 Correct 20 ms 28672 KB Output is correct
9 Correct 20 ms 28672 KB Output is correct
10 Correct 20 ms 28672 KB Output is correct
11 Correct 19 ms 28672 KB Output is correct
12 Correct 20 ms 28544 KB Output is correct
13 Correct 23 ms 28672 KB Output is correct
14 Correct 20 ms 28672 KB Output is correct
15 Correct 20 ms 28544 KB Output is correct
16 Correct 19 ms 28544 KB Output is correct
17 Correct 20 ms 28544 KB Output is correct
18 Correct 19 ms 28672 KB Output is correct
19 Correct 20 ms 28672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 28544 KB Output is correct
2 Correct 19 ms 28544 KB Output is correct
3 Correct 19 ms 28544 KB Output is correct
4 Correct 19 ms 28544 KB Output is correct
5 Correct 20 ms 28544 KB Output is correct
6 Correct 19 ms 28672 KB Output is correct
7 Correct 21 ms 28672 KB Output is correct
8 Correct 20 ms 28672 KB Output is correct
9 Correct 20 ms 28672 KB Output is correct
10 Correct 20 ms 28672 KB Output is correct
11 Correct 19 ms 28672 KB Output is correct
12 Correct 20 ms 28544 KB Output is correct
13 Correct 23 ms 28672 KB Output is correct
14 Correct 20 ms 28672 KB Output is correct
15 Correct 20 ms 28544 KB Output is correct
16 Correct 19 ms 28544 KB Output is correct
17 Correct 20 ms 28544 KB Output is correct
18 Correct 19 ms 28672 KB Output is correct
19 Correct 20 ms 28672 KB Output is correct
20 Correct 23 ms 29600 KB Output is correct
21 Correct 24 ms 29568 KB Output is correct
22 Correct 21 ms 29312 KB Output is correct
23 Correct 23 ms 29696 KB Output is correct
24 Correct 22 ms 29568 KB Output is correct
25 Correct 22 ms 29184 KB Output is correct
26 Correct 22 ms 29312 KB Output is correct
27 Correct 22 ms 29568 KB Output is correct
28 Correct 24 ms 29564 KB Output is correct
29 Correct 20 ms 29312 KB Output is correct
30 Correct 21 ms 29440 KB Output is correct
31 Correct 21 ms 29312 KB Output is correct
32 Correct 21 ms 29440 KB Output is correct
33 Correct 22 ms 29440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 28544 KB Output is correct
2 Correct 19 ms 28544 KB Output is correct
3 Correct 19 ms 28544 KB Output is correct
4 Correct 19 ms 28544 KB Output is correct
5 Correct 20 ms 28544 KB Output is correct
6 Correct 19 ms 28672 KB Output is correct
7 Correct 21 ms 28672 KB Output is correct
8 Correct 20 ms 28672 KB Output is correct
9 Correct 20 ms 28672 KB Output is correct
10 Correct 20 ms 28672 KB Output is correct
11 Correct 19 ms 28672 KB Output is correct
12 Correct 20 ms 28544 KB Output is correct
13 Correct 23 ms 28672 KB Output is correct
14 Correct 20 ms 28672 KB Output is correct
15 Correct 20 ms 28544 KB Output is correct
16 Correct 19 ms 28544 KB Output is correct
17 Correct 20 ms 28544 KB Output is correct
18 Correct 19 ms 28672 KB Output is correct
19 Correct 20 ms 28672 KB Output is correct
20 Correct 23 ms 29600 KB Output is correct
21 Correct 24 ms 29568 KB Output is correct
22 Correct 21 ms 29312 KB Output is correct
23 Correct 23 ms 29696 KB Output is correct
24 Correct 22 ms 29568 KB Output is correct
25 Correct 22 ms 29184 KB Output is correct
26 Correct 22 ms 29312 KB Output is correct
27 Correct 22 ms 29568 KB Output is correct
28 Correct 24 ms 29564 KB Output is correct
29 Correct 20 ms 29312 KB Output is correct
30 Correct 21 ms 29440 KB Output is correct
31 Correct 21 ms 29312 KB Output is correct
32 Correct 21 ms 29440 KB Output is correct
33 Correct 22 ms 29440 KB Output is correct
34 Correct 89 ms 46968 KB Output is correct
35 Correct 101 ms 47736 KB Output is correct
36 Correct 57 ms 46200 KB Output is correct
37 Correct 65 ms 49144 KB Output is correct
38 Correct 55 ms 42744 KB Output is correct
39 Correct 40 ms 38908 KB Output is correct
40 Correct 56 ms 46200 KB Output is correct
41 Correct 46 ms 45440 KB Output is correct
42 Correct 57 ms 47032 KB Output is correct
43 Correct 64 ms 45432 KB Output is correct
44 Correct 65 ms 45560 KB Output is correct
45 Correct 64 ms 45432 KB Output is correct
46 Correct 66 ms 45432 KB Output is correct
47 Correct 66 ms 44280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 28544 KB Output is correct
2 Correct 19 ms 28544 KB Output is correct
3 Correct 19 ms 28544 KB Output is correct
4 Correct 19 ms 28544 KB Output is correct
5 Correct 20 ms 28544 KB Output is correct
6 Correct 19 ms 28672 KB Output is correct
7 Correct 21 ms 28672 KB Output is correct
8 Correct 20 ms 28672 KB Output is correct
9 Correct 20 ms 28672 KB Output is correct
10 Correct 20 ms 28672 KB Output is correct
11 Correct 19 ms 28672 KB Output is correct
12 Correct 20 ms 28544 KB Output is correct
13 Correct 23 ms 28672 KB Output is correct
14 Correct 20 ms 28672 KB Output is correct
15 Correct 20 ms 28544 KB Output is correct
16 Correct 19 ms 28544 KB Output is correct
17 Correct 20 ms 28544 KB Output is correct
18 Correct 19 ms 28672 KB Output is correct
19 Correct 20 ms 28672 KB Output is correct
20 Correct 23 ms 29600 KB Output is correct
21 Correct 24 ms 29568 KB Output is correct
22 Correct 21 ms 29312 KB Output is correct
23 Correct 23 ms 29696 KB Output is correct
24 Correct 22 ms 29568 KB Output is correct
25 Correct 22 ms 29184 KB Output is correct
26 Correct 22 ms 29312 KB Output is correct
27 Correct 22 ms 29568 KB Output is correct
28 Correct 24 ms 29564 KB Output is correct
29 Correct 20 ms 29312 KB Output is correct
30 Correct 21 ms 29440 KB Output is correct
31 Correct 21 ms 29312 KB Output is correct
32 Correct 21 ms 29440 KB Output is correct
33 Correct 22 ms 29440 KB Output is correct
34 Correct 89 ms 46968 KB Output is correct
35 Correct 101 ms 47736 KB Output is correct
36 Correct 57 ms 46200 KB Output is correct
37 Correct 65 ms 49144 KB Output is correct
38 Correct 55 ms 42744 KB Output is correct
39 Correct 40 ms 38908 KB Output is correct
40 Correct 56 ms 46200 KB Output is correct
41 Correct 46 ms 45440 KB Output is correct
42 Correct 57 ms 47032 KB Output is correct
43 Correct 64 ms 45432 KB Output is correct
44 Correct 65 ms 45560 KB Output is correct
45 Correct 64 ms 45432 KB Output is correct
46 Correct 66 ms 45432 KB Output is correct
47 Correct 66 ms 44280 KB Output is correct
48 Correct 110 ms 50168 KB Output is correct
49 Correct 120 ms 50552 KB Output is correct
50 Correct 61 ms 46576 KB Output is correct
51 Correct 81 ms 53240 KB Output is correct
52 Correct 63 ms 45480 KB Output is correct
53 Correct 43 ms 39668 KB Output is correct
54 Correct 60 ms 46328 KB Output is correct
55 Correct 59 ms 49016 KB Output is correct
56 Correct 81 ms 50348 KB Output is correct
57 Correct 63 ms 45560 KB Output is correct
58 Correct 66 ms 45560 KB Output is correct
59 Correct 64 ms 45560 KB Output is correct
60 Correct 68 ms 46456 KB Output is correct
61 Correct 70 ms 46456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 249 ms 56056 KB Output is correct
2 Correct 374 ms 56580 KB Output is correct
3 Correct 396 ms 56704 KB Output is correct
4 Correct 375 ms 56560 KB Output is correct
5 Correct 237 ms 55980 KB Output is correct
6 Correct 383 ms 56460 KB Output is correct
7 Correct 387 ms 56492 KB Output is correct
8 Correct 383 ms 56548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 41780 KB Output is correct
2 Correct 114 ms 41976 KB Output is correct
3 Correct 110 ms 47992 KB Output is correct
4 Correct 110 ms 45688 KB Output is correct
5 Correct 103 ms 44024 KB Output is correct
6 Correct 61 ms 40564 KB Output is correct
7 Correct 104 ms 48120 KB Output is correct
8 Correct 67 ms 40700 KB Output is correct
9 Correct 84 ms 41720 KB Output is correct
10 Correct 73 ms 47092 KB Output is correct
11 Correct 60 ms 47272 KB Output is correct
12 Correct 64 ms 47224 KB Output is correct
13 Correct 109 ms 47864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 28544 KB Output is correct
2 Correct 19 ms 28544 KB Output is correct
3 Correct 19 ms 28544 KB Output is correct
4 Correct 19 ms 28544 KB Output is correct
5 Correct 20 ms 28544 KB Output is correct
6 Correct 19 ms 28672 KB Output is correct
7 Correct 21 ms 28672 KB Output is correct
8 Correct 20 ms 28672 KB Output is correct
9 Correct 20 ms 28672 KB Output is correct
10 Correct 20 ms 28672 KB Output is correct
11 Correct 19 ms 28672 KB Output is correct
12 Correct 20 ms 28544 KB Output is correct
13 Correct 23 ms 28672 KB Output is correct
14 Correct 20 ms 28672 KB Output is correct
15 Correct 20 ms 28544 KB Output is correct
16 Correct 19 ms 28544 KB Output is correct
17 Correct 20 ms 28544 KB Output is correct
18 Correct 19 ms 28672 KB Output is correct
19 Correct 20 ms 28672 KB Output is correct
20 Correct 23 ms 29600 KB Output is correct
21 Correct 24 ms 29568 KB Output is correct
22 Correct 21 ms 29312 KB Output is correct
23 Correct 23 ms 29696 KB Output is correct
24 Correct 22 ms 29568 KB Output is correct
25 Correct 22 ms 29184 KB Output is correct
26 Correct 22 ms 29312 KB Output is correct
27 Correct 22 ms 29568 KB Output is correct
28 Correct 24 ms 29564 KB Output is correct
29 Correct 20 ms 29312 KB Output is correct
30 Correct 21 ms 29440 KB Output is correct
31 Correct 21 ms 29312 KB Output is correct
32 Correct 21 ms 29440 KB Output is correct
33 Correct 22 ms 29440 KB Output is correct
34 Correct 89 ms 46968 KB Output is correct
35 Correct 101 ms 47736 KB Output is correct
36 Correct 57 ms 46200 KB Output is correct
37 Correct 65 ms 49144 KB Output is correct
38 Correct 55 ms 42744 KB Output is correct
39 Correct 40 ms 38908 KB Output is correct
40 Correct 56 ms 46200 KB Output is correct
41 Correct 46 ms 45440 KB Output is correct
42 Correct 57 ms 47032 KB Output is correct
43 Correct 64 ms 45432 KB Output is correct
44 Correct 65 ms 45560 KB Output is correct
45 Correct 64 ms 45432 KB Output is correct
46 Correct 66 ms 45432 KB Output is correct
47 Correct 66 ms 44280 KB Output is correct
48 Correct 110 ms 50168 KB Output is correct
49 Correct 120 ms 50552 KB Output is correct
50 Correct 61 ms 46576 KB Output is correct
51 Correct 81 ms 53240 KB Output is correct
52 Correct 63 ms 45480 KB Output is correct
53 Correct 43 ms 39668 KB Output is correct
54 Correct 60 ms 46328 KB Output is correct
55 Correct 59 ms 49016 KB Output is correct
56 Correct 81 ms 50348 KB Output is correct
57 Correct 63 ms 45560 KB Output is correct
58 Correct 66 ms 45560 KB Output is correct
59 Correct 64 ms 45560 KB Output is correct
60 Correct 68 ms 46456 KB Output is correct
61 Correct 70 ms 46456 KB Output is correct
62 Correct 249 ms 56056 KB Output is correct
63 Correct 374 ms 56580 KB Output is correct
64 Correct 396 ms 56704 KB Output is correct
65 Correct 375 ms 56560 KB Output is correct
66 Correct 237 ms 55980 KB Output is correct
67 Correct 383 ms 56460 KB Output is correct
68 Correct 387 ms 56492 KB Output is correct
69 Correct 383 ms 56548 KB Output is correct
70 Correct 115 ms 41780 KB Output is correct
71 Correct 114 ms 41976 KB Output is correct
72 Correct 110 ms 47992 KB Output is correct
73 Correct 110 ms 45688 KB Output is correct
74 Correct 103 ms 44024 KB Output is correct
75 Correct 61 ms 40564 KB Output is correct
76 Correct 104 ms 48120 KB Output is correct
77 Correct 67 ms 40700 KB Output is correct
78 Correct 84 ms 41720 KB Output is correct
79 Correct 73 ms 47092 KB Output is correct
80 Correct 60 ms 47272 KB Output is correct
81 Correct 64 ms 47224 KB Output is correct
82 Correct 109 ms 47864 KB Output is correct
83 Correct 402 ms 56460 KB Output is correct
84 Correct 513 ms 57224 KB Output is correct
85 Correct 115 ms 47864 KB Output is correct
86 Correct 351 ms 59040 KB Output is correct
87 Correct 164 ms 56184 KB Output is correct
88 Correct 121 ms 46836 KB Output is correct
89 Correct 115 ms 47916 KB Output is correct
90 Correct 185 ms 54828 KB Output is correct
91 Correct 373 ms 57748 KB Output is correct
92 Correct 165 ms 48928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 28544 KB Output is correct
2 Correct 19 ms 28544 KB Output is correct
3 Correct 19 ms 28544 KB Output is correct
4 Correct 19 ms 28544 KB Output is correct
5 Correct 20 ms 28544 KB Output is correct
6 Correct 19 ms 28672 KB Output is correct
7 Correct 21 ms 28672 KB Output is correct
8 Correct 20 ms 28672 KB Output is correct
9 Correct 20 ms 28672 KB Output is correct
10 Correct 20 ms 28672 KB Output is correct
11 Correct 19 ms 28672 KB Output is correct
12 Correct 20 ms 28544 KB Output is correct
13 Correct 23 ms 28672 KB Output is correct
14 Correct 20 ms 28672 KB Output is correct
15 Correct 20 ms 28544 KB Output is correct
16 Correct 19 ms 28544 KB Output is correct
17 Correct 20 ms 28544 KB Output is correct
18 Correct 19 ms 28672 KB Output is correct
19 Correct 20 ms 28672 KB Output is correct
20 Correct 23 ms 29600 KB Output is correct
21 Correct 24 ms 29568 KB Output is correct
22 Correct 21 ms 29312 KB Output is correct
23 Correct 23 ms 29696 KB Output is correct
24 Correct 22 ms 29568 KB Output is correct
25 Correct 22 ms 29184 KB Output is correct
26 Correct 22 ms 29312 KB Output is correct
27 Correct 22 ms 29568 KB Output is correct
28 Correct 24 ms 29564 KB Output is correct
29 Correct 20 ms 29312 KB Output is correct
30 Correct 21 ms 29440 KB Output is correct
31 Correct 21 ms 29312 KB Output is correct
32 Correct 21 ms 29440 KB Output is correct
33 Correct 22 ms 29440 KB Output is correct
34 Correct 89 ms 46968 KB Output is correct
35 Correct 101 ms 47736 KB Output is correct
36 Correct 57 ms 46200 KB Output is correct
37 Correct 65 ms 49144 KB Output is correct
38 Correct 55 ms 42744 KB Output is correct
39 Correct 40 ms 38908 KB Output is correct
40 Correct 56 ms 46200 KB Output is correct
41 Correct 46 ms 45440 KB Output is correct
42 Correct 57 ms 47032 KB Output is correct
43 Correct 64 ms 45432 KB Output is correct
44 Correct 65 ms 45560 KB Output is correct
45 Correct 64 ms 45432 KB Output is correct
46 Correct 66 ms 45432 KB Output is correct
47 Correct 66 ms 44280 KB Output is correct
48 Correct 110 ms 50168 KB Output is correct
49 Correct 120 ms 50552 KB Output is correct
50 Correct 61 ms 46576 KB Output is correct
51 Correct 81 ms 53240 KB Output is correct
52 Correct 63 ms 45480 KB Output is correct
53 Correct 43 ms 39668 KB Output is correct
54 Correct 60 ms 46328 KB Output is correct
55 Correct 59 ms 49016 KB Output is correct
56 Correct 81 ms 50348 KB Output is correct
57 Correct 63 ms 45560 KB Output is correct
58 Correct 66 ms 45560 KB Output is correct
59 Correct 64 ms 45560 KB Output is correct
60 Correct 68 ms 46456 KB Output is correct
61 Correct 70 ms 46456 KB Output is correct
62 Correct 249 ms 56056 KB Output is correct
63 Correct 374 ms 56580 KB Output is correct
64 Correct 396 ms 56704 KB Output is correct
65 Correct 375 ms 56560 KB Output is correct
66 Correct 237 ms 55980 KB Output is correct
67 Correct 383 ms 56460 KB Output is correct
68 Correct 387 ms 56492 KB Output is correct
69 Correct 383 ms 56548 KB Output is correct
70 Correct 115 ms 41780 KB Output is correct
71 Correct 114 ms 41976 KB Output is correct
72 Correct 110 ms 47992 KB Output is correct
73 Correct 110 ms 45688 KB Output is correct
74 Correct 103 ms 44024 KB Output is correct
75 Correct 61 ms 40564 KB Output is correct
76 Correct 104 ms 48120 KB Output is correct
77 Correct 67 ms 40700 KB Output is correct
78 Correct 84 ms 41720 KB Output is correct
79 Correct 73 ms 47092 KB Output is correct
80 Correct 60 ms 47272 KB Output is correct
81 Correct 64 ms 47224 KB Output is correct
82 Correct 109 ms 47864 KB Output is correct
83 Correct 402 ms 56460 KB Output is correct
84 Correct 513 ms 57224 KB Output is correct
85 Correct 115 ms 47864 KB Output is correct
86 Correct 351 ms 59040 KB Output is correct
87 Correct 164 ms 56184 KB Output is correct
88 Correct 121 ms 46836 KB Output is correct
89 Correct 115 ms 47916 KB Output is correct
90 Correct 185 ms 54828 KB Output is correct
91 Correct 373 ms 57748 KB Output is correct
92 Correct 165 ms 48928 KB Output is correct
93 Correct 1841 ms 91628 KB Output is correct
94 Correct 2286 ms 93380 KB Output is correct
95 Correct 373 ms 69788 KB Output is correct
96 Correct 1569 ms 95776 KB Output is correct
97 Correct 622 ms 90432 KB Output is correct
98 Correct 403 ms 78912 KB Output is correct
99 Correct 371 ms 69620 KB Output is correct
100 Correct 731 ms 88108 KB Output is correct
101 Correct 1598 ms 96176 KB Output is correct
102 Correct 159 ms 66284 KB Output is correct
103 Correct 149 ms 67320 KB Output is correct
104 Correct 157 ms 67972 KB Output is correct
105 Correct 413 ms 84088 KB Output is correct
106 Correct 716 ms 73812 KB Output is correct