답안 #927646

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
927646 2024-02-15T08:07:52 Z andrei_boaca Jail (JOI22_jail) C++17
77 / 100
5000 ms 183284 KB
#include <bits/stdc++.h>

using namespace std;
typedef pair<int,int> pii;
int t,n,m,A[120005],B[120005],in[120005],out[120005],timp,par[120005],niv[120005],dp[21][120005],nr[120005];
bool isheavy[120005];
vector<int> muchii[120005];
vector<vector<int>> v;
vector<set<pii>> suf,active;
set<pii> vtm;
vector<vector<set<int>>> arb;
vector<int> tati;
vector<set<int>> emp;
int where[120005],poz[120005];
vector<int> stiva;
bool use[120005];
bool isancestor(int a,int b)
{
    return in[a]<=in[b]&&out[a]>=out[b];
}
int LCA(int a,int b)
{
    if(niv[a]>niv[b])
        swap(a,b);
    if(isancestor(a,b))
        return a;
    for(int i=18;i>=0;i--)
        if(dp[i][a]!=0&&!isancestor(dp[i][a],b))
            a=dp[i][a];
    return par[a];
}
int dist(int a,int b)
{
    int lca=LCA(a,b);
    return niv[a]+niv[b]-2*niv[lca];
}
void initdfs(int nod)
{
    nr[nod]=1;
    timp++;
    in[nod]=timp;
    dp[0][nod]=par[nod];
    for(int i=1;i<=18;i++)
        dp[i][nod]=dp[i-1][dp[i-1][nod]];
    int who=0,maxim=0;
    for(int i:muchii[nod])
        if(i!=par[nod])
        {
            par[i]=nod;
            niv[i]=niv[nod]+1;
            initdfs(i);
            nr[nod]+=nr[i];
            if(nr[i]>maxim)
            {
                maxim=nr[i];
                who=i;
            }
        }
    if(who!=0)
        isheavy[who]=1;
    out[nod]=timp;
}
void buildhld()
{
    for(int i=1;i<=n;i++)
    {
        bool ok=1;
        for(int j:muchii[i])
            if(j!=par[i]&&isheavy[j])
            {
                ok=0;
                break;
            }
        if(ok)
        {
            vector<int> nodes;
            int nod=i;
            while(true)
            {
                nodes.push_back(nod);
                if(!isheavy[nod])
                    break;
                nod=par[nod];
            }
            for(int i=0;i<nodes.size();i++)
            {
                where[nodes[i]]=v.size();
                poz[nodes[i]]=i;
            }
            v.push_back(nodes);
            arb.push_back(emp);
            suf.push_back(vtm);
            active.push_back(vtm);
            int lg=arb.size();
            lg--;
            arb[lg].resize(5*(int)nodes.size()+5);
        }
    }
}
void addnode(int nod,int ind,int add)
{
    int chain=where[nod];
    int p=poz[nod];
    if(add==1)
        active[chain].insert({p,ind});
    else if(active[chain].find({p,ind})!=active[chain].end())
        active[chain].erase({p,ind});
    else
        assert(false);
}
void update(int chain,int nod,int st,int dr,int a,int b,int val,int add)
{
    assert(nod<arb[chain].size());
    if(st>=a&&dr<=b)
    {
        if(add==1)
            arb[chain][nod].insert(val);
        else if(arb[chain][nod].find(val)!=arb[chain][nod].end())
            arb[chain][nod].erase(val);
        else
            assert(false);
        return;
    }
    int mij=(st+dr)/2;
    if(a<=mij)
        update(chain,nod*2,st,mij,a,b,val,add);
    if(b>mij)
        update(chain,nod*2+1,mij+1,dr,a,b,val,add);
}
void query(int chain,int nod,int st,int dr,int p)
{
    assert(nod<arb[chain].size());
    tati.push_back(nod);
    if(st==dr)
        return;
    int mij=(st+dr)/2;
    if(p<=mij)
        query(chain,nod*2,st,mij,p);
    if(p>mij)
        query(chain,nod*2+1,mij+1,dr,p);
}
void addseg(int a,int b,int ind,int add)
{
    int lca=LCA(a,b);
    while(niv[a]>=niv[lca])
    {
        int p=poz[a];
        int chain=where[a];
        int last=v[chain].size();
        last--;
        if(where[a]==where[lca])
            last=poz[lca];
        if(p<=last)
        {
            if(last!=(int)v[chain].size()-1)
            {
                bool ok=0;
                if(ind==2)
                    ok=1;
                update(chain,1,0,(int)v[chain].size()-1,p,last,ind,add);
            }
            else
            {
                pii x={p,ind};
                if(add==1)
                    suf[chain].insert(x);
                else if(suf[chain].find(x)!=suf[chain].end())
                    suf[chain].erase(x);
                else
                    assert(false);
            }
        }
        a=par[v[chain][last]];
    }

    while(niv[b]>niv[lca])
    {
        int p=poz[b];
        int chain=where[b];
        int last=v[chain].size();
        last--;
        if(where[b]==where[lca])
            last=poz[lca]-1;
        if(p<=last)
        {
            if(last!=(int)v[chain].size()-1)
                update(chain,1,0,(int)v[chain].size()-1,p,last,ind,add);
            else
            {
                pii x={p,ind};
                if(add==1)
                    suf[chain].insert(x);
                else if(suf[chain].find(x)!=suf[chain].end())
                    suf[chain].erase(x);
                else
                    assert(false);
            }
        }
        b=par[v[chain][last]];
    }
}
void dfs1(int nod)
{
    use[nod]=1;
    addseg(A[nod],B[nod],nod,-1);
    addnode(B[nod],nod,-1);
    int chain=where[A[nod]];
    int p=poz[A[nod]];
    while(!suf[chain].empty())
    {
        auto it=suf[chain].upper_bound({p,1e9});
        if(it==suf[chain].begin())
            break;
        it=prev(it);
        int x=(*it).second;
        dfs1(x);
    }
    tati.clear();
    query(chain,1,0,v[chain].size()-1,p);
    vector<int> aux=tati;
    for(int x:aux)
    {
        while(!arb[chain][x].empty())
        {
            int y=*arb[chain][x].begin();
            dfs1(y);
        }
    }
    int a=A[nod];
    int b=B[nod];
    int lca=LCA(a,b);
    while(a!=0&&niv[a]>=niv[lca])
    {
        p=poz[a];
        chain=where[a];
        int last=v[chain].size();
        last--;
        if(where[a]==where[lca])
            last=poz[lca];
        while(!active[chain].empty())
        {
            auto it=active[chain].lower_bound({p,0});
            if(it==active[chain].end())
                break;
            if((*it).first>last)
                break;
            int x=(*it).second;
            dfs1(x);
        }
        a=par[v[chain][last]];
    }
    while(b!=0&&niv[b]>niv[lca])
    {
        p=poz[b];
        chain=where[b];
        int last=v[chain].size();
        last--;
        if(where[b]==where[lca])
            last=poz[lca]-1;
        while(!active[chain].empty())
        {
            auto it=active[chain].lower_bound({p,0});
            if(it==active[chain].end())
                break;
            if((*it).first>last)
                break;
            int x=(*it).second;
            dfs1(x);
        }
        b=par[v[chain][last]];
    }
    stiva.push_back(nod);
}
void dfs2(int nod)
{
    use[nod]=1;
    addseg(A[nod],B[nod],nod,-1);
    addnode(A[nod],nod,-1);
    int chain=where[B[nod]];
    int p=poz[B[nod]];
    while(!suf[chain].empty())
    {
        auto it=suf[chain].upper_bound({p,1e9});
        if(it==suf[chain].begin())
            break;
        it=prev(it);
        int x=(*it).second;
        dfs2(x);
    }
    tati.clear();
    query(chain,1,0,v[chain].size()-1,p);
    for(int x:tati)
    {
        while(!arb[chain][x].empty())
        {
            int y=*arb[chain][x].begin();
            dfs2(y);
        }
    }
    int a=A[nod];
    int b=B[nod];
    int lca=LCA(a,b);
    while(a!=0&&niv[a]>=niv[lca])
    {
        p=poz[a];
        chain=where[a];
        int last=v[chain].size();
        last--;
        if(where[a]==where[lca])
            last=poz[lca];
        while(!active[chain].empty())
        {
            auto it=active[chain].lower_bound({p,0});
            if(it==active[chain].end())
                break;
            if((*it).first>last)
                break;
            int x=(*it).second;
            dfs2(x);
        }
        a=par[v[chain][last]];
    }
    while(b!=0&&niv[b]>niv[lca])
    {
        p=poz[b];
        chain=where[b];
        int last=v[chain].size();
        last--;
        if(where[b]==where[lca])
            last=poz[lca]-1;
        while(!active[chain].empty())
        {
            auto it=active[chain].lower_bound({p,0});
            if(it==active[chain].end())
                break;
            if((*it).first>last)
                break;
            int x=(*it).second;
            dfs2(x);
        }
        b=par[v[chain][last]];
    }
}
bool onchain(int x,int a,int b)
{
    return dist(a,x)+dist(x,b)==dist(a,b);
}
int curtest=0;
void solve()
{
    curtest++;
    cin>>n;
    timp=0;
    v.clear();
    suf.clear();
    active.clear();
    arb.clear();
    arb.shrink_to_fit();
    timp=0;
    for(int i=1;i<=n;i++)
    {
        muchii[i].clear();
        isheavy[i]=0;
    }
    for(int i=1;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        muchii[a].push_back(b);
        muchii[b].push_back(a);
    }
    niv[1]=1;
    par[1]=0;
    initdfs(1);
    cin>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>A[i]>>B[i];
        use[i]=0;
    }
    /*if(curtest!=18)
        return;
    if(onchain(A[1],A[2],B[2]))
        cout<<"Este\n";*/
    buildhld();
    stiva.clear();
    for(int i=1;i<=m;i++)
    {
        addseg(A[i],B[i],i,+1);
        addnode(B[i],i,+1);
    }
    for(int i=1;i<=m;i++)
        if(!use[i])
            dfs1(i);
    reverse(stiva.begin(),stiva.end());
    for(int i=1;i<=m;i++)
    {
        use[i]=0;
        addseg(A[i],B[i],i,+1);
        addnode(A[i],i,+1);
    }
    int nrcomp=0;
    for(int i:stiva)
        if(!use[i])
        {
            nrcomp++;
            dfs2(i);
        }
    if(nrcomp==m)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    /*for(int i=1;i<=m;i++)
        for(int j=1;j<=m;j++)
            if(i!=j)
            {
                if(onchain(A[j],A[i],B[i]))
                {
                    //edges[j].push_back(i);
                    //grad[i]++;
                    cout<<j<<' '<<i<<'\n';
                }
                if(onchain(B[j],A[i],B[i]))
                {
                    //edges[i].push_back(j);
                    //grad[j]++;
                    cout<<i<<' '<<j<<'\n';
                }
            }*/

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>t;
    while(t--)
        solve();
    return 0;
}

Compilation message

jail.cpp: In function 'void buildhld()':
jail.cpp:85:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |             for(int i=0;i<nodes.size();i++)
      |                         ~^~~~~~~~~~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from jail.cpp:1:
jail.cpp: In function 'void update(int, int, int, int, int, int, int, int)':
jail.cpp:113:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::set<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  113 |     assert(nod<arb[chain].size());
      |            ~~~^~~~~~~~~~~~~~~~~~
jail.cpp: In function 'void query(int, int, int, int, int)':
jail.cpp:132:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::set<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  132 |     assert(nod<arb[chain].size());
      |            ~~~^~~~~~~~~~~~~~~~~~
jail.cpp: In function 'void addseg(int, int, int, int)':
jail.cpp:157:22: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
  157 |                 bool ok=0;
      |                      ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16732 KB Output is correct
2 Correct 2 ms 16732 KB Output is correct
3 Correct 2 ms 16728 KB Output is correct
4 Correct 15 ms 16880 KB Output is correct
5 Correct 24 ms 16732 KB Output is correct
6 Correct 4 ms 16732 KB Output is correct
7 Correct 4 ms 16732 KB Output is correct
8 Correct 8 ms 16988 KB Output is correct
9 Correct 53 ms 19396 KB Output is correct
10 Correct 59 ms 61172 KB Output is correct
11 Correct 15 ms 16732 KB Output is correct
12 Correct 92 ms 16732 KB Output is correct
13 Correct 207 ms 80624 KB Output is correct
14 Correct 194 ms 79856 KB Output is correct
15 Correct 1028 ms 99616 KB Output is correct
16 Correct 3491 ms 158132 KB Output is correct
17 Correct 463 ms 111848 KB Output is correct
18 Correct 285 ms 78628 KB Output is correct
19 Correct 418 ms 106992 KB Output is correct
20 Correct 416 ms 106740 KB Output is correct
21 Correct 527 ms 110064 KB Output is correct
22 Correct 163 ms 69460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16728 KB Output is correct
2 Correct 2 ms 16732 KB Output is correct
3 Correct 3 ms 16732 KB Output is correct
4 Correct 5 ms 16988 KB Output is correct
5 Correct 3 ms 16988 KB Output is correct
6 Correct 4 ms 16988 KB Output is correct
7 Correct 4 ms 16988 KB Output is correct
8 Correct 3 ms 16872 KB Output is correct
9 Correct 4 ms 16988 KB Output is correct
10 Correct 4 ms 16988 KB Output is correct
11 Correct 4 ms 16988 KB Output is correct
12 Correct 3 ms 16988 KB Output is correct
13 Correct 3 ms 16988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16728 KB Output is correct
2 Correct 2 ms 16732 KB Output is correct
3 Correct 3 ms 16732 KB Output is correct
4 Correct 5 ms 16988 KB Output is correct
5 Correct 3 ms 16988 KB Output is correct
6 Correct 4 ms 16988 KB Output is correct
7 Correct 4 ms 16988 KB Output is correct
8 Correct 3 ms 16872 KB Output is correct
9 Correct 4 ms 16988 KB Output is correct
10 Correct 4 ms 16988 KB Output is correct
11 Correct 4 ms 16988 KB Output is correct
12 Correct 3 ms 16988 KB Output is correct
13 Correct 3 ms 16988 KB Output is correct
14 Correct 2 ms 16984 KB Output is correct
15 Correct 3 ms 16984 KB Output is correct
16 Correct 3 ms 16732 KB Output is correct
17 Correct 4 ms 16984 KB Output is correct
18 Correct 4 ms 16984 KB Output is correct
19 Correct 2 ms 16732 KB Output is correct
20 Correct 4 ms 16984 KB Output is correct
21 Correct 4 ms 16988 KB Output is correct
22 Correct 4 ms 16988 KB Output is correct
23 Correct 2 ms 16732 KB Output is correct
24 Correct 4 ms 16728 KB Output is correct
25 Correct 3 ms 16988 KB Output is correct
26 Correct 3 ms 16732 KB Output is correct
27 Correct 4 ms 16988 KB Output is correct
28 Correct 3 ms 16728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16728 KB Output is correct
2 Correct 2 ms 16732 KB Output is correct
3 Correct 3 ms 16732 KB Output is correct
4 Correct 5 ms 16988 KB Output is correct
5 Correct 3 ms 16988 KB Output is correct
6 Correct 4 ms 16988 KB Output is correct
7 Correct 4 ms 16988 KB Output is correct
8 Correct 3 ms 16872 KB Output is correct
9 Correct 4 ms 16988 KB Output is correct
10 Correct 4 ms 16988 KB Output is correct
11 Correct 4 ms 16988 KB Output is correct
12 Correct 3 ms 16988 KB Output is correct
13 Correct 3 ms 16988 KB Output is correct
14 Correct 2 ms 16984 KB Output is correct
15 Correct 3 ms 16984 KB Output is correct
16 Correct 3 ms 16732 KB Output is correct
17 Correct 4 ms 16984 KB Output is correct
18 Correct 4 ms 16984 KB Output is correct
19 Correct 2 ms 16732 KB Output is correct
20 Correct 4 ms 16984 KB Output is correct
21 Correct 4 ms 16988 KB Output is correct
22 Correct 4 ms 16988 KB Output is correct
23 Correct 2 ms 16732 KB Output is correct
24 Correct 4 ms 16728 KB Output is correct
25 Correct 3 ms 16988 KB Output is correct
26 Correct 3 ms 16732 KB Output is correct
27 Correct 4 ms 16988 KB Output is correct
28 Correct 3 ms 16728 KB Output is correct
29 Correct 7 ms 16988 KB Output is correct
30 Correct 7 ms 16988 KB Output is correct
31 Correct 7 ms 16988 KB Output is correct
32 Correct 6 ms 16988 KB Output is correct
33 Correct 4 ms 17064 KB Output is correct
34 Correct 12 ms 16988 KB Output is correct
35 Correct 12 ms 17092 KB Output is correct
36 Correct 6 ms 16988 KB Output is correct
37 Correct 6 ms 16896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16728 KB Output is correct
2 Correct 2 ms 16732 KB Output is correct
3 Correct 3 ms 16732 KB Output is correct
4 Correct 5 ms 16988 KB Output is correct
5 Correct 3 ms 16988 KB Output is correct
6 Correct 4 ms 16988 KB Output is correct
7 Correct 4 ms 16988 KB Output is correct
8 Correct 3 ms 16872 KB Output is correct
9 Correct 4 ms 16988 KB Output is correct
10 Correct 4 ms 16988 KB Output is correct
11 Correct 4 ms 16988 KB Output is correct
12 Correct 3 ms 16988 KB Output is correct
13 Correct 3 ms 16988 KB Output is correct
14 Correct 2 ms 16984 KB Output is correct
15 Correct 3 ms 16984 KB Output is correct
16 Correct 3 ms 16732 KB Output is correct
17 Correct 4 ms 16984 KB Output is correct
18 Correct 4 ms 16984 KB Output is correct
19 Correct 2 ms 16732 KB Output is correct
20 Correct 4 ms 16984 KB Output is correct
21 Correct 4 ms 16988 KB Output is correct
22 Correct 4 ms 16988 KB Output is correct
23 Correct 2 ms 16732 KB Output is correct
24 Correct 4 ms 16728 KB Output is correct
25 Correct 3 ms 16988 KB Output is correct
26 Correct 3 ms 16732 KB Output is correct
27 Correct 4 ms 16988 KB Output is correct
28 Correct 3 ms 16728 KB Output is correct
29 Correct 7 ms 16988 KB Output is correct
30 Correct 7 ms 16988 KB Output is correct
31 Correct 7 ms 16988 KB Output is correct
32 Correct 6 ms 16988 KB Output is correct
33 Correct 4 ms 17064 KB Output is correct
34 Correct 12 ms 16988 KB Output is correct
35 Correct 12 ms 17092 KB Output is correct
36 Correct 6 ms 16988 KB Output is correct
37 Correct 6 ms 16896 KB Output is correct
38 Correct 55 ms 20656 KB Output is correct
39 Correct 48 ms 62452 KB Output is correct
40 Correct 87 ms 22044 KB Output is correct
41 Correct 97 ms 21072 KB Output is correct
42 Correct 63 ms 22784 KB Output is correct
43 Correct 33 ms 20768 KB Output is correct
44 Correct 48 ms 18184 KB Output is correct
45 Correct 84 ms 70172 KB Output is correct
46 Correct 83 ms 69592 KB Output is correct
47 Correct 67 ms 72412 KB Output is correct
48 Correct 65 ms 74012 KB Output is correct
49 Correct 78 ms 69912 KB Output is correct
50 Correct 77 ms 70428 KB Output is correct
51 Correct 65 ms 70852 KB Output is correct
52 Correct 64 ms 71268 KB Output is correct
53 Correct 26 ms 21188 KB Output is correct
54 Correct 104 ms 73696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16732 KB Output is correct
2 Correct 2 ms 16728 KB Output is correct
3 Correct 2 ms 16728 KB Output is correct
4 Correct 3 ms 16732 KB Output is correct
5 Correct 15 ms 16732 KB Output is correct
6 Correct 3 ms 16988 KB Output is correct
7 Correct 3 ms 16988 KB Output is correct
8 Correct 3 ms 16732 KB Output is correct
9 Correct 3 ms 16860 KB Output is correct
10 Correct 3 ms 16732 KB Output is correct
11 Correct 3 ms 16728 KB Output is correct
12 Correct 6 ms 16988 KB Output is correct
13 Correct 77 ms 16980 KB Output is correct
14 Correct 95 ms 17728 KB Output is correct
15 Correct 97 ms 17616 KB Output is correct
16 Correct 222 ms 90808 KB Output is correct
17 Correct 1477 ms 118412 KB Output is correct
18 Correct 3530 ms 160724 KB Output is correct
19 Correct 380 ms 93172 KB Output is correct
20 Correct 402 ms 90576 KB Output is correct
21 Correct 379 ms 93244 KB Output is correct
22 Correct 1418 ms 116584 KB Output is correct
23 Correct 696 ms 117944 KB Output is correct
24 Correct 723 ms 120828 KB Output is correct
25 Correct 775 ms 122480 KB Output is correct
26 Correct 782 ms 122160 KB Output is correct
27 Correct 876 ms 131192 KB Output is correct
28 Correct 881 ms 141684 KB Output is correct
29 Correct 945 ms 135280 KB Output is correct
30 Correct 452 ms 94844 KB Output is correct
31 Correct 457 ms 96360 KB Output is correct
32 Correct 449 ms 92244 KB Output is correct
33 Correct 443 ms 95732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16732 KB Output is correct
2 Correct 2 ms 16732 KB Output is correct
3 Correct 2 ms 16728 KB Output is correct
4 Correct 15 ms 16880 KB Output is correct
5 Correct 24 ms 16732 KB Output is correct
6 Correct 4 ms 16732 KB Output is correct
7 Correct 4 ms 16732 KB Output is correct
8 Correct 8 ms 16988 KB Output is correct
9 Correct 53 ms 19396 KB Output is correct
10 Correct 59 ms 61172 KB Output is correct
11 Correct 15 ms 16732 KB Output is correct
12 Correct 92 ms 16732 KB Output is correct
13 Correct 207 ms 80624 KB Output is correct
14 Correct 194 ms 79856 KB Output is correct
15 Correct 1028 ms 99616 KB Output is correct
16 Correct 3491 ms 158132 KB Output is correct
17 Correct 463 ms 111848 KB Output is correct
18 Correct 285 ms 78628 KB Output is correct
19 Correct 418 ms 106992 KB Output is correct
20 Correct 416 ms 106740 KB Output is correct
21 Correct 527 ms 110064 KB Output is correct
22 Correct 163 ms 69460 KB Output is correct
23 Correct 2 ms 16728 KB Output is correct
24 Correct 2 ms 16732 KB Output is correct
25 Correct 3 ms 16732 KB Output is correct
26 Correct 5 ms 16988 KB Output is correct
27 Correct 3 ms 16988 KB Output is correct
28 Correct 4 ms 16988 KB Output is correct
29 Correct 4 ms 16988 KB Output is correct
30 Correct 3 ms 16872 KB Output is correct
31 Correct 4 ms 16988 KB Output is correct
32 Correct 4 ms 16988 KB Output is correct
33 Correct 4 ms 16988 KB Output is correct
34 Correct 3 ms 16988 KB Output is correct
35 Correct 3 ms 16988 KB Output is correct
36 Correct 2 ms 16984 KB Output is correct
37 Correct 3 ms 16984 KB Output is correct
38 Correct 3 ms 16732 KB Output is correct
39 Correct 4 ms 16984 KB Output is correct
40 Correct 4 ms 16984 KB Output is correct
41 Correct 2 ms 16732 KB Output is correct
42 Correct 4 ms 16984 KB Output is correct
43 Correct 4 ms 16988 KB Output is correct
44 Correct 4 ms 16988 KB Output is correct
45 Correct 2 ms 16732 KB Output is correct
46 Correct 4 ms 16728 KB Output is correct
47 Correct 3 ms 16988 KB Output is correct
48 Correct 3 ms 16732 KB Output is correct
49 Correct 4 ms 16988 KB Output is correct
50 Correct 3 ms 16728 KB Output is correct
51 Correct 7 ms 16988 KB Output is correct
52 Correct 7 ms 16988 KB Output is correct
53 Correct 7 ms 16988 KB Output is correct
54 Correct 6 ms 16988 KB Output is correct
55 Correct 4 ms 17064 KB Output is correct
56 Correct 12 ms 16988 KB Output is correct
57 Correct 12 ms 17092 KB Output is correct
58 Correct 6 ms 16988 KB Output is correct
59 Correct 6 ms 16896 KB Output is correct
60 Correct 55 ms 20656 KB Output is correct
61 Correct 48 ms 62452 KB Output is correct
62 Correct 87 ms 22044 KB Output is correct
63 Correct 97 ms 21072 KB Output is correct
64 Correct 63 ms 22784 KB Output is correct
65 Correct 33 ms 20768 KB Output is correct
66 Correct 48 ms 18184 KB Output is correct
67 Correct 84 ms 70172 KB Output is correct
68 Correct 83 ms 69592 KB Output is correct
69 Correct 67 ms 72412 KB Output is correct
70 Correct 65 ms 74012 KB Output is correct
71 Correct 78 ms 69912 KB Output is correct
72 Correct 77 ms 70428 KB Output is correct
73 Correct 65 ms 70852 KB Output is correct
74 Correct 64 ms 71268 KB Output is correct
75 Correct 26 ms 21188 KB Output is correct
76 Correct 104 ms 73696 KB Output is correct
77 Correct 2 ms 16732 KB Output is correct
78 Correct 2 ms 16728 KB Output is correct
79 Correct 2 ms 16728 KB Output is correct
80 Correct 3 ms 16732 KB Output is correct
81 Correct 15 ms 16732 KB Output is correct
82 Correct 3 ms 16988 KB Output is correct
83 Correct 3 ms 16988 KB Output is correct
84 Correct 3 ms 16732 KB Output is correct
85 Correct 3 ms 16860 KB Output is correct
86 Correct 3 ms 16732 KB Output is correct
87 Correct 3 ms 16728 KB Output is correct
88 Correct 6 ms 16988 KB Output is correct
89 Correct 77 ms 16980 KB Output is correct
90 Correct 95 ms 17728 KB Output is correct
91 Correct 97 ms 17616 KB Output is correct
92 Correct 222 ms 90808 KB Output is correct
93 Correct 1477 ms 118412 KB Output is correct
94 Correct 3530 ms 160724 KB Output is correct
95 Correct 380 ms 93172 KB Output is correct
96 Correct 402 ms 90576 KB Output is correct
97 Correct 379 ms 93244 KB Output is correct
98 Correct 1418 ms 116584 KB Output is correct
99 Correct 696 ms 117944 KB Output is correct
100 Correct 723 ms 120828 KB Output is correct
101 Correct 775 ms 122480 KB Output is correct
102 Correct 782 ms 122160 KB Output is correct
103 Correct 876 ms 131192 KB Output is correct
104 Correct 881 ms 141684 KB Output is correct
105 Correct 945 ms 135280 KB Output is correct
106 Correct 452 ms 94844 KB Output is correct
107 Correct 457 ms 96360 KB Output is correct
108 Correct 449 ms 92244 KB Output is correct
109 Correct 443 ms 95732 KB Output is correct
110 Correct 95 ms 17784 KB Output is correct
111 Correct 46 ms 17748 KB Output is correct
112 Correct 1773 ms 120640 KB Output is correct
113 Correct 476 ms 90616 KB Output is correct
114 Correct 981 ms 115344 KB Output is correct
115 Correct 86 ms 102048 KB Output is correct
116 Correct 460 ms 102500 KB Output is correct
117 Execution timed out 5071 ms 183284 KB Time limit exceeded
118 Halted 0 ms 0 KB -