Submission #932788

# Submission time Handle Problem Language Result Execution time Memory
932788 2024-02-24T08:23:19 Z abcvuitunggio Beech Tree (IOI23_beechtree) C++17
100 / 100
1585 ms 177004 KB
#include "beechtree.h"
#include <bits/stdc++.h>
using namespace std;
const int lim=200001,mxn=2e7+1;
int n,m,bad[lim],sz[lim],tin[lim],tout[lim],t,id,pos[lim],order[lim],root[lim][2],last[lim],cur,a[lim],b[lim];
int le[mxn],ri[mxn],st[mxn];
vector <int> p,c,res,ke[lim],ve[lim],s[lim],sc[lim],tmp;
vector <pair <int, int>> ve2;
void dfs(int u){
    sz[u]=1;
    tin[u]=++t;
    for (int v:ke[u]){
        dfs(v);
        sz[u]+=sz[v];
    }
    tout[u]=t;
    ve[sz[u]].push_back(u);
}
int update(int node, int l, int r, int i){
    cur++;
    if (l==r){
        st[cur]++;
        return cur;
    }
    int tmp=cur,mid=(l+r)>>1;
    le[tmp]=le[node];
    ri[tmp]=ri[node];
    if (mid<i)
        ri[tmp]=update(ri[node],mid+1,r,i);
    else
        le[tmp]=update(le[node],l,mid,i);
    st[tmp]=st[le[tmp]]+st[ri[tmp]];
    return tmp;
}
int get(int node, int l, int r, int u, int v){
    if (l>v||r<u||!node)
        return 0;
    if (l>=u&&r<=v)
        return st[node];
    int mid=(l+r)>>1;
    return get(le[node],l,mid,u,v)+get(ri[node],mid+1,r,u,v);
}
int get(int i, int j, int k){
    int res=get(root[i][k],1,n,tin[j],tout[j])-1;
    return res-(k&&c[i]==c[j]);
}
void dfs2(int u){
    if (ke[u].empty()){
        s[u].push_back(pos[u]);
        return;
    }
    int mx=0,bigchild=-1;
    for (int v:ke[u])
        if (sz[v]>mx){
            bigchild=v;
            mx=sz[v];
        }
    for (int v:ke[u]){
        dfs2(v);
        bad[u]|=bad[v];
    }
    if (bad[u])
        return;
    swap(s[u],s[bigchild]);
    s[u].push_back(pos[u]);
    for (int v:ke[u])
        if (v!=bigchild){
            for (int i:s[v]){
                a[order[i]]=get(order[i],u,0);
                b[order[i]]=get(order[i],u,1);
            }
            for (int i:s[v])
                if (b[order[i]]!=a[p[order[i]]]){
                    bad[u]=1;
                    return;
                }
        }
    if (get(bigchild,u,1)){
        bad[u]=1;
        return;
    }
    for (int v:ke[u])
        if (v!=bigchild){
            for (int i:s[v]){
                s[u].push_back(i);
                tmp.push_back(a[order[i]]);
                sc[c[order[i]]].push_back(b[order[i]]);
            }
            s[v].clear();
        }
    sc[c[bigchild]].push_back(get(bigchild,u,1));
    tmp.push_back(0);
    tmp.push_back(sz[u]);
    sort(tmp.begin(),tmp.end());
    int last=-1;
    ve2.clear();
    for (int i:tmp){
        int x=i-last-1;
        if (x)
            ve2.push_back({x,last});
        last=i;
    }
    tmp.clear();
    int cnt=0;
    for (int v:ke[u]){
        int i=c[v];
        int num=get(::last[i],1,n,tin[u],tout[u])-(c[u]==i);
        int id=0;
        pair <int, int> cur=ve2[0];
        sc[i].push_back(num);
        sort(sc[i].begin(),sc[i].end());
        int last=-1;
        for (int j:sc[i]){
            int x=j-last-1;
            if (x){
                cnt+=x;
                if (!(x<=cur.first&&last==cur.second)){
                    bad[u]=1;
                    for (int v:ke[u])
                        sc[c[v]].clear();
                    return;
                }
                cur.first-=x;
                if (!cur.first){
                    id++;
                    cur=(id==ve2.size()?make_pair(0,0):ve2[id]);
                }
            }
            last=j;
        }
        sc[i].clear();
    }
    if (cnt<sz[bigchild]-1)
        bad[u]=1;
}
vector <int> beechtree(int N, int M, vector<int> P, vector<int> C){
    n=N,m=M,p=P,c=C;
    for (int i=1;i<n;i++)
        ke[P[i]].push_back(i);
    dfs(0);
    for (int i=n;i>=0;i--){
        sort(ve[i].begin(),ve[i].end(),[](int u, int v){return pos[p[u]]<pos[p[v]];});
        for (int j:ve[i]){
            pos[j]=++id;
            order[id]=j;
        }
    }
    for (int i=1;i<=n;i++){
        int j=order[i];
        root[j][0]=update(root[order[i-1]][0],1,n,tin[j]);
        root[j][1]=update(last[c[j]],1,n,tin[j]);
        last[c[j]]=root[j][1];
    }
    dfs2(0);
    for (int i=0;i<n;i++)
        res.push_back(bad[i]^1);
    return res;
}

Compilation message

beechtree.cpp: In function 'void dfs2(int)':
beechtree.cpp:126:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  126 |                     cur=(id==ve2.size()?make_pair(0,0):ve2[id]);
      |                          ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 5 ms 25180 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 23132 KB Output is correct
2 Correct 5 ms 23384 KB Output is correct
3 Correct 5 ms 23132 KB Output is correct
4 Correct 5 ms 23132 KB Output is correct
5 Correct 5 ms 23132 KB Output is correct
6 Correct 5 ms 23196 KB Output is correct
7 Correct 5 ms 25180 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 5 ms 25180 KB Output is correct
10 Correct 6 ms 25244 KB Output is correct
11 Correct 5 ms 25180 KB Output is correct
12 Correct 5 ms 25180 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25176 KB Output is correct
15 Correct 5 ms 25176 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25268 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 6 ms 25180 KB Output is correct
20 Correct 6 ms 25180 KB Output is correct
21 Correct 5 ms 25180 KB Output is correct
22 Correct 5 ms 23132 KB Output is correct
23 Correct 5 ms 23132 KB Output is correct
24 Correct 5 ms 25180 KB Output is correct
25 Correct 5 ms 25180 KB Output is correct
26 Correct 6 ms 25180 KB Output is correct
27 Correct 5 ms 25212 KB Output is correct
28 Correct 6 ms 25180 KB Output is correct
29 Correct 5 ms 25272 KB Output is correct
30 Correct 5 ms 25180 KB Output is correct
31 Correct 5 ms 25180 KB Output is correct
32 Correct 5 ms 25180 KB Output is correct
33 Correct 6 ms 25272 KB Output is correct
34 Correct 6 ms 25376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 23132 KB Output is correct
2 Correct 5 ms 23384 KB Output is correct
3 Correct 5 ms 23132 KB Output is correct
4 Correct 5 ms 23132 KB Output is correct
5 Correct 5 ms 23132 KB Output is correct
6 Correct 5 ms 23196 KB Output is correct
7 Correct 184 ms 176792 KB Output is correct
8 Correct 165 ms 176848 KB Output is correct
9 Correct 6 ms 23132 KB Output is correct
10 Correct 5 ms 23132 KB Output is correct
11 Correct 5 ms 23132 KB Output is correct
12 Correct 5 ms 23132 KB Output is correct
13 Correct 7 ms 24156 KB Output is correct
14 Correct 7 ms 24152 KB Output is correct
15 Correct 7 ms 24924 KB Output is correct
16 Correct 7 ms 24924 KB Output is correct
17 Correct 228 ms 176820 KB Output is correct
18 Correct 198 ms 176468 KB Output is correct
19 Correct 178 ms 177004 KB Output is correct
20 Correct 197 ms 176848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25180 KB Output is correct
2 Correct 5 ms 25212 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 6 ms 25216 KB Output is correct
6 Correct 5 ms 25176 KB Output is correct
7 Correct 5 ms 25180 KB Output is correct
8 Correct 5 ms 25180 KB Output is correct
9 Correct 5 ms 25180 KB Output is correct
10 Correct 6 ms 25180 KB Output is correct
11 Correct 7 ms 25692 KB Output is correct
12 Correct 6 ms 25692 KB Output is correct
13 Correct 7 ms 25688 KB Output is correct
14 Correct 6 ms 25688 KB Output is correct
15 Correct 147 ms 82036 KB Output is correct
16 Correct 142 ms 75480 KB Output is correct
17 Correct 160 ms 79360 KB Output is correct
18 Correct 154 ms 81336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 23132 KB Output is correct
2 Correct 5 ms 23384 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Correct 184 ms 176792 KB Output is correct
6 Correct 165 ms 176848 KB Output is correct
7 Correct 6 ms 25432 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 9 ms 26460 KB Output is correct
10 Correct 9 ms 26456 KB Output is correct
11 Correct 318 ms 140808 KB Output is correct
12 Correct 220 ms 129356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 5 ms 25180 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
4 Correct 5 ms 23132 KB Output is correct
5 Correct 5 ms 23384 KB Output is correct
6 Correct 5 ms 23132 KB Output is correct
7 Correct 5 ms 23132 KB Output is correct
8 Correct 5 ms 23132 KB Output is correct
9 Correct 5 ms 23196 KB Output is correct
10 Correct 5 ms 25180 KB Output is correct
11 Correct 6 ms 25180 KB Output is correct
12 Correct 5 ms 25180 KB Output is correct
13 Correct 6 ms 25244 KB Output is correct
14 Correct 5 ms 25180 KB Output is correct
15 Correct 5 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25176 KB Output is correct
18 Correct 5 ms 25176 KB Output is correct
19 Correct 6 ms 25180 KB Output is correct
20 Correct 6 ms 25268 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 6 ms 25180 KB Output is correct
24 Correct 5 ms 25180 KB Output is correct
25 Correct 5 ms 23132 KB Output is correct
26 Correct 5 ms 23132 KB Output is correct
27 Correct 5 ms 25180 KB Output is correct
28 Correct 5 ms 25180 KB Output is correct
29 Correct 6 ms 25180 KB Output is correct
30 Correct 5 ms 25212 KB Output is correct
31 Correct 6 ms 25180 KB Output is correct
32 Correct 5 ms 25272 KB Output is correct
33 Correct 5 ms 25180 KB Output is correct
34 Correct 5 ms 25180 KB Output is correct
35 Correct 5 ms 25180 KB Output is correct
36 Correct 6 ms 25272 KB Output is correct
37 Correct 6 ms 25376 KB Output is correct
38 Correct 6 ms 23132 KB Output is correct
39 Correct 5 ms 23132 KB Output is correct
40 Correct 5 ms 23132 KB Output is correct
41 Correct 5 ms 23132 KB Output is correct
42 Correct 6 ms 25180 KB Output is correct
43 Correct 5 ms 25212 KB Output is correct
44 Correct 5 ms 25180 KB Output is correct
45 Correct 5 ms 25180 KB Output is correct
46 Correct 6 ms 25216 KB Output is correct
47 Correct 5 ms 25176 KB Output is correct
48 Correct 5 ms 25180 KB Output is correct
49 Correct 5 ms 25180 KB Output is correct
50 Correct 5 ms 25180 KB Output is correct
51 Correct 6 ms 25180 KB Output is correct
52 Correct 6 ms 25432 KB Output is correct
53 Correct 6 ms 25180 KB Output is correct
54 Correct 7 ms 25180 KB Output is correct
55 Correct 6 ms 25180 KB Output is correct
56 Correct 6 ms 25180 KB Output is correct
57 Correct 5 ms 25176 KB Output is correct
58 Correct 7 ms 25436 KB Output is correct
59 Correct 5 ms 25180 KB Output is correct
60 Correct 6 ms 25180 KB Output is correct
61 Correct 5 ms 25280 KB Output is correct
62 Correct 5 ms 25180 KB Output is correct
63 Correct 6 ms 25180 KB Output is correct
64 Correct 5 ms 25176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 23132 KB Output is correct
2 Correct 5 ms 23384 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 6 ms 25244 KB Output is correct
7 Correct 5 ms 25180 KB Output is correct
8 Correct 5 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 6 ms 25176 KB Output is correct
11 Correct 5 ms 25176 KB Output is correct
12 Correct 6 ms 25180 KB Output is correct
13 Correct 6 ms 25268 KB Output is correct
14 Correct 6 ms 25180 KB Output is correct
15 Correct 6 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 5 ms 25180 KB Output is correct
18 Correct 5 ms 23132 KB Output is correct
19 Correct 5 ms 23132 KB Output is correct
20 Correct 5 ms 25180 KB Output is correct
21 Correct 5 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 5 ms 25212 KB Output is correct
24 Correct 6 ms 25180 KB Output is correct
25 Correct 7 ms 24156 KB Output is correct
26 Correct 7 ms 24412 KB Output is correct
27 Correct 7 ms 24156 KB Output is correct
28 Correct 8 ms 24156 KB Output is correct
29 Correct 7 ms 24156 KB Output is correct
30 Correct 7 ms 25692 KB Output is correct
31 Correct 10 ms 25948 KB Output is correct
32 Correct 8 ms 25688 KB Output is correct
33 Correct 8 ms 25688 KB Output is correct
34 Correct 9 ms 25692 KB Output is correct
35 Correct 9 ms 25692 KB Output is correct
36 Correct 7 ms 25804 KB Output is correct
37 Correct 8 ms 25944 KB Output is correct
38 Correct 7 ms 25692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 5 ms 25180 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
4 Correct 5 ms 23132 KB Output is correct
5 Correct 5 ms 23384 KB Output is correct
6 Correct 5 ms 23132 KB Output is correct
7 Correct 5 ms 23132 KB Output is correct
8 Correct 5 ms 23132 KB Output is correct
9 Correct 5 ms 23196 KB Output is correct
10 Correct 5 ms 25180 KB Output is correct
11 Correct 6 ms 25180 KB Output is correct
12 Correct 5 ms 25180 KB Output is correct
13 Correct 6 ms 25244 KB Output is correct
14 Correct 5 ms 25180 KB Output is correct
15 Correct 5 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25176 KB Output is correct
18 Correct 5 ms 25176 KB Output is correct
19 Correct 6 ms 25180 KB Output is correct
20 Correct 6 ms 25268 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 6 ms 25180 KB Output is correct
24 Correct 5 ms 25180 KB Output is correct
25 Correct 5 ms 23132 KB Output is correct
26 Correct 5 ms 23132 KB Output is correct
27 Correct 5 ms 25180 KB Output is correct
28 Correct 5 ms 25180 KB Output is correct
29 Correct 6 ms 25180 KB Output is correct
30 Correct 5 ms 25212 KB Output is correct
31 Correct 6 ms 25180 KB Output is correct
32 Correct 5 ms 25272 KB Output is correct
33 Correct 5 ms 25180 KB Output is correct
34 Correct 5 ms 25180 KB Output is correct
35 Correct 5 ms 25180 KB Output is correct
36 Correct 6 ms 25272 KB Output is correct
37 Correct 6 ms 25376 KB Output is correct
38 Correct 6 ms 23132 KB Output is correct
39 Correct 5 ms 23132 KB Output is correct
40 Correct 5 ms 23132 KB Output is correct
41 Correct 5 ms 23132 KB Output is correct
42 Correct 7 ms 24156 KB Output is correct
43 Correct 7 ms 24152 KB Output is correct
44 Correct 7 ms 24924 KB Output is correct
45 Correct 7 ms 24924 KB Output is correct
46 Correct 6 ms 25180 KB Output is correct
47 Correct 5 ms 25212 KB Output is correct
48 Correct 5 ms 25180 KB Output is correct
49 Correct 5 ms 25180 KB Output is correct
50 Correct 6 ms 25216 KB Output is correct
51 Correct 5 ms 25176 KB Output is correct
52 Correct 5 ms 25180 KB Output is correct
53 Correct 5 ms 25180 KB Output is correct
54 Correct 5 ms 25180 KB Output is correct
55 Correct 6 ms 25180 KB Output is correct
56 Correct 7 ms 25692 KB Output is correct
57 Correct 6 ms 25692 KB Output is correct
58 Correct 7 ms 25688 KB Output is correct
59 Correct 6 ms 25688 KB Output is correct
60 Correct 6 ms 25432 KB Output is correct
61 Correct 6 ms 25180 KB Output is correct
62 Correct 9 ms 26460 KB Output is correct
63 Correct 9 ms 26456 KB Output is correct
64 Correct 7 ms 25180 KB Output is correct
65 Correct 6 ms 25180 KB Output is correct
66 Correct 6 ms 25180 KB Output is correct
67 Correct 5 ms 25176 KB Output is correct
68 Correct 7 ms 25436 KB Output is correct
69 Correct 5 ms 25180 KB Output is correct
70 Correct 6 ms 25180 KB Output is correct
71 Correct 5 ms 25280 KB Output is correct
72 Correct 5 ms 25180 KB Output is correct
73 Correct 6 ms 25180 KB Output is correct
74 Correct 5 ms 25176 KB Output is correct
75 Correct 7 ms 24156 KB Output is correct
76 Correct 7 ms 24412 KB Output is correct
77 Correct 7 ms 24156 KB Output is correct
78 Correct 8 ms 24156 KB Output is correct
79 Correct 7 ms 24156 KB Output is correct
80 Correct 7 ms 25692 KB Output is correct
81 Correct 10 ms 25948 KB Output is correct
82 Correct 8 ms 25688 KB Output is correct
83 Correct 8 ms 25688 KB Output is correct
84 Correct 9 ms 25692 KB Output is correct
85 Correct 9 ms 25692 KB Output is correct
86 Correct 7 ms 25804 KB Output is correct
87 Correct 8 ms 25944 KB Output is correct
88 Correct 7 ms 25692 KB Output is correct
89 Correct 8 ms 25944 KB Output is correct
90 Correct 8 ms 25944 KB Output is correct
91 Correct 11 ms 25688 KB Output is correct
92 Correct 8 ms 25948 KB Output is correct
93 Correct 8 ms 26204 KB Output is correct
94 Correct 10 ms 25688 KB Output is correct
95 Correct 10 ms 25692 KB Output is correct
96 Correct 9 ms 26204 KB Output is correct
97 Correct 9 ms 25948 KB Output is correct
98 Correct 7 ms 25692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 23132 KB Output is correct
2 Correct 5 ms 23384 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 6 ms 25244 KB Output is correct
7 Correct 5 ms 25180 KB Output is correct
8 Correct 5 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 6 ms 25176 KB Output is correct
11 Correct 5 ms 25176 KB Output is correct
12 Correct 6 ms 25180 KB Output is correct
13 Correct 6 ms 25268 KB Output is correct
14 Correct 6 ms 25180 KB Output is correct
15 Correct 6 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 5 ms 25180 KB Output is correct
18 Correct 5 ms 23132 KB Output is correct
19 Correct 5 ms 23132 KB Output is correct
20 Correct 5 ms 25180 KB Output is correct
21 Correct 5 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 5 ms 25212 KB Output is correct
24 Correct 6 ms 25180 KB Output is correct
25 Correct 7 ms 24156 KB Output is correct
26 Correct 7 ms 24412 KB Output is correct
27 Correct 7 ms 24156 KB Output is correct
28 Correct 8 ms 24156 KB Output is correct
29 Correct 7 ms 24156 KB Output is correct
30 Correct 7 ms 25692 KB Output is correct
31 Correct 10 ms 25948 KB Output is correct
32 Correct 8 ms 25688 KB Output is correct
33 Correct 8 ms 25688 KB Output is correct
34 Correct 9 ms 25692 KB Output is correct
35 Correct 9 ms 25692 KB Output is correct
36 Correct 7 ms 25804 KB Output is correct
37 Correct 8 ms 25944 KB Output is correct
38 Correct 7 ms 25692 KB Output is correct
39 Correct 223 ms 176796 KB Output is correct
40 Correct 221 ms 176364 KB Output is correct
41 Correct 183 ms 176368 KB Output is correct
42 Correct 150 ms 176084 KB Output is correct
43 Correct 294 ms 164328 KB Output is correct
44 Correct 378 ms 139460 KB Output is correct
45 Correct 1585 ms 139492 KB Output is correct
46 Correct 718 ms 137812 KB Output is correct
47 Correct 579 ms 136760 KB Output is correct
48 Correct 540 ms 135860 KB Output is correct
49 Correct 415 ms 130984 KB Output is correct
50 Correct 912 ms 140744 KB Output is correct
51 Correct 666 ms 138772 KB Output is correct
52 Correct 533 ms 137556 KB Output is correct
53 Correct 460 ms 136280 KB Output is correct
54 Correct 381 ms 127564 KB Output is correct
55 Correct 230 ms 150976 KB Output is correct
56 Correct 224 ms 151584 KB Output is correct
57 Correct 275 ms 136320 KB Output is correct
58 Correct 255 ms 134980 KB Output is correct
59 Correct 273 ms 134768 KB Output is correct
60 Correct 254 ms 134984 KB Output is correct
61 Correct 285 ms 134644 KB Output is correct
62 Correct 264 ms 134732 KB Output is correct
63 Correct 297 ms 147264 KB Output is correct
64 Correct 261 ms 140420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 5 ms 25180 KB Output is correct
3 Correct 5 ms 25180 KB Output is correct
4 Correct 5 ms 23132 KB Output is correct
5 Correct 5 ms 23384 KB Output is correct
6 Correct 5 ms 23132 KB Output is correct
7 Correct 5 ms 23132 KB Output is correct
8 Correct 5 ms 23132 KB Output is correct
9 Correct 5 ms 23196 KB Output is correct
10 Correct 5 ms 25180 KB Output is correct
11 Correct 6 ms 25180 KB Output is correct
12 Correct 5 ms 25180 KB Output is correct
13 Correct 6 ms 25244 KB Output is correct
14 Correct 5 ms 25180 KB Output is correct
15 Correct 5 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25176 KB Output is correct
18 Correct 5 ms 25176 KB Output is correct
19 Correct 6 ms 25180 KB Output is correct
20 Correct 6 ms 25268 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 6 ms 25180 KB Output is correct
24 Correct 5 ms 25180 KB Output is correct
25 Correct 5 ms 23132 KB Output is correct
26 Correct 5 ms 23132 KB Output is correct
27 Correct 5 ms 25180 KB Output is correct
28 Correct 5 ms 25180 KB Output is correct
29 Correct 6 ms 25180 KB Output is correct
30 Correct 5 ms 25212 KB Output is correct
31 Correct 6 ms 25180 KB Output is correct
32 Correct 5 ms 25272 KB Output is correct
33 Correct 5 ms 25180 KB Output is correct
34 Correct 5 ms 25180 KB Output is correct
35 Correct 5 ms 25180 KB Output is correct
36 Correct 6 ms 25272 KB Output is correct
37 Correct 6 ms 25376 KB Output is correct
38 Correct 184 ms 176792 KB Output is correct
39 Correct 165 ms 176848 KB Output is correct
40 Correct 6 ms 23132 KB Output is correct
41 Correct 5 ms 23132 KB Output is correct
42 Correct 5 ms 23132 KB Output is correct
43 Correct 5 ms 23132 KB Output is correct
44 Correct 7 ms 24156 KB Output is correct
45 Correct 7 ms 24152 KB Output is correct
46 Correct 7 ms 24924 KB Output is correct
47 Correct 7 ms 24924 KB Output is correct
48 Correct 228 ms 176820 KB Output is correct
49 Correct 198 ms 176468 KB Output is correct
50 Correct 178 ms 177004 KB Output is correct
51 Correct 197 ms 176848 KB Output is correct
52 Correct 6 ms 25180 KB Output is correct
53 Correct 5 ms 25212 KB Output is correct
54 Correct 5 ms 25180 KB Output is correct
55 Correct 5 ms 25180 KB Output is correct
56 Correct 6 ms 25216 KB Output is correct
57 Correct 5 ms 25176 KB Output is correct
58 Correct 5 ms 25180 KB Output is correct
59 Correct 5 ms 25180 KB Output is correct
60 Correct 5 ms 25180 KB Output is correct
61 Correct 6 ms 25180 KB Output is correct
62 Correct 7 ms 25692 KB Output is correct
63 Correct 6 ms 25692 KB Output is correct
64 Correct 7 ms 25688 KB Output is correct
65 Correct 6 ms 25688 KB Output is correct
66 Correct 147 ms 82036 KB Output is correct
67 Correct 142 ms 75480 KB Output is correct
68 Correct 160 ms 79360 KB Output is correct
69 Correct 154 ms 81336 KB Output is correct
70 Correct 6 ms 25432 KB Output is correct
71 Correct 6 ms 25180 KB Output is correct
72 Correct 9 ms 26460 KB Output is correct
73 Correct 9 ms 26456 KB Output is correct
74 Correct 318 ms 140808 KB Output is correct
75 Correct 220 ms 129356 KB Output is correct
76 Correct 7 ms 25180 KB Output is correct
77 Correct 6 ms 25180 KB Output is correct
78 Correct 6 ms 25180 KB Output is correct
79 Correct 5 ms 25176 KB Output is correct
80 Correct 7 ms 25436 KB Output is correct
81 Correct 5 ms 25180 KB Output is correct
82 Correct 6 ms 25180 KB Output is correct
83 Correct 5 ms 25280 KB Output is correct
84 Correct 5 ms 25180 KB Output is correct
85 Correct 6 ms 25180 KB Output is correct
86 Correct 5 ms 25176 KB Output is correct
87 Correct 7 ms 24156 KB Output is correct
88 Correct 7 ms 24412 KB Output is correct
89 Correct 7 ms 24156 KB Output is correct
90 Correct 8 ms 24156 KB Output is correct
91 Correct 7 ms 24156 KB Output is correct
92 Correct 7 ms 25692 KB Output is correct
93 Correct 10 ms 25948 KB Output is correct
94 Correct 8 ms 25688 KB Output is correct
95 Correct 8 ms 25688 KB Output is correct
96 Correct 9 ms 25692 KB Output is correct
97 Correct 9 ms 25692 KB Output is correct
98 Correct 7 ms 25804 KB Output is correct
99 Correct 8 ms 25944 KB Output is correct
100 Correct 7 ms 25692 KB Output is correct
101 Correct 8 ms 25944 KB Output is correct
102 Correct 8 ms 25944 KB Output is correct
103 Correct 11 ms 25688 KB Output is correct
104 Correct 8 ms 25948 KB Output is correct
105 Correct 8 ms 26204 KB Output is correct
106 Correct 10 ms 25688 KB Output is correct
107 Correct 10 ms 25692 KB Output is correct
108 Correct 9 ms 26204 KB Output is correct
109 Correct 9 ms 25948 KB Output is correct
110 Correct 7 ms 25692 KB Output is correct
111 Correct 223 ms 176796 KB Output is correct
112 Correct 221 ms 176364 KB Output is correct
113 Correct 183 ms 176368 KB Output is correct
114 Correct 150 ms 176084 KB Output is correct
115 Correct 294 ms 164328 KB Output is correct
116 Correct 378 ms 139460 KB Output is correct
117 Correct 1585 ms 139492 KB Output is correct
118 Correct 718 ms 137812 KB Output is correct
119 Correct 579 ms 136760 KB Output is correct
120 Correct 540 ms 135860 KB Output is correct
121 Correct 415 ms 130984 KB Output is correct
122 Correct 912 ms 140744 KB Output is correct
123 Correct 666 ms 138772 KB Output is correct
124 Correct 533 ms 137556 KB Output is correct
125 Correct 460 ms 136280 KB Output is correct
126 Correct 381 ms 127564 KB Output is correct
127 Correct 230 ms 150976 KB Output is correct
128 Correct 224 ms 151584 KB Output is correct
129 Correct 275 ms 136320 KB Output is correct
130 Correct 255 ms 134980 KB Output is correct
131 Correct 273 ms 134768 KB Output is correct
132 Correct 254 ms 134984 KB Output is correct
133 Correct 285 ms 134644 KB Output is correct
134 Correct 264 ms 134732 KB Output is correct
135 Correct 297 ms 147264 KB Output is correct
136 Correct 261 ms 140420 KB Output is correct
137 Correct 305 ms 158508 KB Output is correct
138 Correct 350 ms 143376 KB Output is correct
139 Correct 1106 ms 140832 KB Output is correct
140 Correct 753 ms 139040 KB Output is correct
141 Correct 548 ms 138432 KB Output is correct
142 Correct 478 ms 137780 KB Output is correct
143 Correct 411 ms 134380 KB Output is correct
144 Correct 683 ms 141504 KB Output is correct
145 Correct 526 ms 139664 KB Output is correct
146 Correct 474 ms 139028 KB Output is correct
147 Correct 513 ms 138116 KB Output is correct
148 Correct 371 ms 129352 KB Output is correct
149 Correct 231 ms 151104 KB Output is correct
150 Correct 218 ms 151112 KB Output is correct
151 Correct 288 ms 137216 KB Output is correct
152 Correct 254 ms 135800 KB Output is correct
153 Correct 269 ms 135616 KB Output is correct
154 Correct 262 ms 135584 KB Output is correct
155 Correct 249 ms 135500 KB Output is correct
156 Correct 256 ms 135500 KB Output is correct
157 Correct 283 ms 148236 KB Output is correct
158 Correct 261 ms 141128 KB Output is correct