Submission #443497

# Submission time Handle Problem Language Result Execution time Memory
443497 2021-07-10T15:38:25 Z urd05 Fountain Parks (IOI21_parks) C++17
30 / 100
2542 ms 108980 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> P;
map<P,int> pt; //점->인덱스
map<P,int> ed; //인덱스쌍->간선인덱스
set<P> vis;
vector<P> edge;
vector<int> adj[400000];
map<P,P> mp;
bool chk[400000];
P ret[400000];
bool ckk[400000];

int p[200000];

int find(int a) {
    return p[a]<0?a:p[a]=find(p[a]);
}

void merge(int a,int b) {
    a=find(a);
    b=find(b);
    if (a==b) {
        return;
    }
    p[a]+=p[b];
    p[b]=a;
}

int construct_roads(vector<int> x, vector<int> y) {
    vector<int> uu;
    vector<int> vv;
    vector<int> aa;
    vector<int> bb;
    memset(p,-1,sizeof(p));
    int n=x.size();
    for(int i=0;i<n;i++) {
        pt[P(x[i],y[i])]=i;
    }
    int m=0;
    for(int i=0;i<n;i++) {
        if (pt.find(P(x[i]-2,y[i]))!=pt.end()) {
            int ind=pt[P(x[i]-2,y[i])];
            if (ed.find(P(ind,i))!=ed.end()) {
                ed[P(i,ind)]=ed[P(ind,i)];
            }
            else {
                ed[P(i,ind)]=m++;
                edge.push_back(P(i,ind));
            }
        }
        if (pt.find(P(x[i]+2,y[i]))!=pt.end()) {
            int ind=pt[P(x[i]+2,y[i])];
            if (ed.find(P(ind,i))!=ed.end()) {
                ed[P(i,ind)]=ed[P(ind,i)];
            }
            else {
                ed[P(i,ind)]=m++;
                edge.push_back(P(i,ind));
            }
        }
        if (pt.find(P(x[i],y[i]-2))!=pt.end()) {
            int ind=pt[P(x[i],y[i]-2)];
            if (ed.find(P(ind,i))!=ed.end()) {
                ed[P(i,ind)]=ed[P(ind,i)];
            }
            else {
                ed[P(i,ind)]=m++;
                edge.push_back(P(i,ind));
            }
        }
        if (pt.find(P(x[i],y[i]+2))!=pt.end()) {
            int ind=pt[P(x[i],y[i]+2)];
            if (ed.find(P(ind,i))!=ed.end()) {
                ed[P(i,ind)]=ed[P(ind,i)];
            }
            else {
                ed[P(i,ind)]=m++;
                edge.push_back(P(i,ind));
            }
        }
    }
    for(int i=0;i<edge.size();i++) {
        merge(edge[i].first,edge[i].second);
    }
    if (-p[find(0)]!=n) {
        return 0;
    }
    for(int i=0;i<edge.size();i++) {
        if (x[edge[i].first]==2&&x[edge[i].second]==2) {
            uu.push_back(edge[i].first);
            vv.push_back(edge[i].second);
            aa.push_back(1);
            bb.push_back((y[edge[i].first]+y[edge[i].second])/2);
            chk[i]=true;
            ckk[i]=true;
        }
        else if (x[edge[i].first]==6&&x[edge[i].second]==6) {
            uu.push_back(edge[i].first);
            vv.push_back(edge[i].second);
            aa.push_back(7);
            bb.push_back((y[edge[i].first]+y[edge[i].second])/2);
            chk[i]=true;
            ckk[i]=true;
        }
        else if (y[edge[i].first]==y[edge[i].second]) {
            int pind1=-1;
            int pind2=-1;
            if (pt.find(P(x[edge[i].first],y[edge[i].first]-2))!=pt.end()) {
                pind1=pt[P(x[edge[i].first],y[edge[i].first]-2)];
            }
            if (pt.find(P(x[edge[i].second],y[edge[i].second]-2))!=pt.end()) {
                pind2=pt[P(x[edge[i].second],y[edge[i].second]-2)];
            }
            if (pind1!=-1&&pind2!=-1) {
                chk[i]=true;
                ckk[i]=true;
            }
        }
    }
    for(int i=0;i<edge.size();i++) {
        if (ckk[i]) {
            continue;
        }
        if (x[edge[i].first]==x[edge[i].second]) {
            int nx=x[edge[i].first]-1;
            int ny=(y[edge[i].first]+y[edge[i].second])/2;
            if (vis.find(P(nx,ny))==vis.end()) {
                bool flag=false;
                if (pt.find(P(nx-1,ny+1))!=pt.end()) {
                    int pind=pt[P(nx-1,ny+1)];
                    int eind=ed[P(pind,pt[P(nx+1,ny+1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (pt.find(P(nx-1,ny-1))!=pt.end()) {
                    int pind=pt[P(nx-1,ny-1)];
                    int eind=ed[P(pind,pt[P(nx+1,ny-1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (!flag) {
                    adj[i].push_back(i);
                    mp[P(i,i)]=P(nx,ny);
                }
                vis.insert(P(nx,ny));
            }
            nx=x[edge[i].first]+1;
            if (vis.find(P(nx,ny))==vis.end()) {
                bool flag=false;
                if (pt.find(P(nx+1,ny+1))!=pt.end()) {
                    int pind=pt[P(nx+1,ny+1)];
                    int eind=ed[P(pind,pt[P(nx-1,ny+1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (pt.find(P(nx+1,ny-1))!=pt.end()) {
                    int pind=pt[P(nx+1,ny-1)];
                    int eind=ed[P(pind,pt[P(nx-1,ny-1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (!flag) {
                    adj[i].push_back(i);
                    mp[P(i,i)]=P(nx,ny);
                }
                vis.insert(P(nx,ny));
            }
        }
        else {
            int nx=(x[edge[i].first]+x[edge[i].second])/2;
            int ny=y[edge[i].first]-1;
            if (vis.find(P(nx,ny))==vis.end()) {
                bool flag=false;
                if (pt.find(P(nx-1,ny-1))!=pt.end()) {
                    int pind=pt[P(nx-1,ny-1)];
                    int eind=ed[P(pind,pt[P(nx-1,ny+1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (pt.find(P(nx+1,ny-1))!=pt.end()) {
                    int pind=pt[P(nx+1,ny-1)];
                    int eind=ed[P(pind,pt[P(nx+1,ny+1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (!flag) {
                    adj[i].push_back(i);
                    mp[P(i,i)]=P(nx,ny);
                }
                vis.insert(P(nx,ny));
            }
            ny=y[edge[i].first]+1;
            if (vis.find(P(nx,ny))==vis.end()) {
                bool flag=false;
                if (pt.find(P(nx-1,ny+1))!=pt.end()) {
                    int pind=pt[P(nx-1,ny+1)];
                    int eind=ed[P(pind,pt[P(nx-1,ny-1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (pt.find(P(nx+1,ny+1))!=pt.end()) {
                    int pind=pt[P(nx+1,ny+1)];
                    int eind=ed[P(pind,pt[P(nx+1,ny-1)])];
                    if (!ckk[eind]) {
                    adj[eind].push_back(i);
                    adj[i].push_back(eind);
                    mp[P(i,eind)]=P(nx,ny);
                    mp[P(eind,i)]=P(nx,ny);
                    flag=true;
                    }
                }
                if (!flag) {
                    adj[i].push_back(i);
                    mp[P(i,i)]=P(nx,ny);
                }
                vis.insert(P(nx,ny));
            }
        }
    }
    /*for(int i=0;i<m;i++) {
        printf("%d\n",adj[i].size());
        for(int j=0;j<adj[i].size();j++) {
            printf("%d ",adj[i][j]);
        }
        printf("\n");
    }*/
    for(int i=0;i<m;i++) {
        if (chk[i]) {
            continue;
        }
        if (adj[i][0]==i||adj[i][1]==i) {

        }
        else {
            continue;
        }
        ret[i]=mp[P(i,i)];
        int now;
        if (adj[i][0]==i) {
            now=adj[i][1];
        }
        else {
            now=adj[i][0];
        }
        chk[i]=true;
        int prev=i;
        while (1) {
            chk[now]=true;
            if (adj[now][0]==now||adj[now][1]==now) {
                ret[now]=mp[P(now,now)];
                break;
            }
            if (adj[now][0]==prev) {
                ret[now]=mp[P(now,adj[now][1])];
                prev=now;
                now=adj[now][1];
            }
            else {
                ret[now]=mp[P(now,adj[now][0])];
                prev=now;
                now=adj[now][0];
            }
        }
    }
    for(int i=0;i<m;i++) {
        if (chk[i]) {
            continue;
        }
        ret[i]=mp[P(i,adj[i][0])];
        int prev=i;
        int now=adj[i][0];
        chk[i]=true;
        while (now!=i) {
            chk[now]=true;
            if (adj[now][0]==prev) {
                ret[now]=mp[P(now,adj[now][1])];
                prev=now;
                now=adj[now][1];
            }
            else {
                ret[now]=mp[P(now,adj[now][0])];
                prev=now;
                now=adj[now][0];
            }
        }
    }
    for(int i=0;i<m;i++) {
            if (ckk[i]) {
                continue;
            }
        uu.push_back(edge[i].first);
        vv.push_back(edge[i].second);
        aa.push_back(ret[i].first);
        bb.push_back(ret[i].second);
    }
    build(uu,vv,aa,bb);
    return 1;
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:85:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |     for(int i=0;i<edge.size();i++) {
      |                 ~^~~~~~~~~~~~
parks.cpp:91:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |     for(int i=0;i<edge.size();i++) {
      |                 ~^~~~~~~~~~~~
parks.cpp:123:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  123 |     for(int i=0;i<edge.size();i++) {
      |                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10444 KB Output is correct
2 Correct 7 ms 10444 KB Output is correct
3 Correct 7 ms 10444 KB Output is correct
4 Correct 8 ms 10444 KB Output is correct
5 Correct 7 ms 10444 KB Output is correct
6 Correct 7 ms 10444 KB Output is correct
7 Correct 7 ms 10444 KB Output is correct
8 Correct 7 ms 10444 KB Output is correct
9 Correct 434 ms 38076 KB Output is correct
10 Correct 27 ms 13260 KB Output is correct
11 Correct 136 ms 25280 KB Output is correct
12 Correct 40 ms 14572 KB Output is correct
13 Correct 89 ms 19692 KB Output is correct
14 Correct 8 ms 10624 KB Output is correct
15 Correct 10 ms 10876 KB Output is correct
16 Correct 410 ms 38044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10444 KB Output is correct
2 Correct 7 ms 10444 KB Output is correct
3 Correct 7 ms 10444 KB Output is correct
4 Correct 8 ms 10444 KB Output is correct
5 Correct 7 ms 10444 KB Output is correct
6 Correct 7 ms 10444 KB Output is correct
7 Correct 7 ms 10444 KB Output is correct
8 Correct 7 ms 10444 KB Output is correct
9 Correct 434 ms 38076 KB Output is correct
10 Correct 27 ms 13260 KB Output is correct
11 Correct 136 ms 25280 KB Output is correct
12 Correct 40 ms 14572 KB Output is correct
13 Correct 89 ms 19692 KB Output is correct
14 Correct 8 ms 10624 KB Output is correct
15 Correct 10 ms 10876 KB Output is correct
16 Correct 410 ms 38044 KB Output is correct
17 Correct 8 ms 10444 KB Output is correct
18 Correct 8 ms 10444 KB Output is correct
19 Correct 8 ms 10444 KB Output is correct
20 Correct 7 ms 10444 KB Output is correct
21 Correct 7 ms 10444 KB Output is correct
22 Correct 7 ms 10444 KB Output is correct
23 Correct 2238 ms 101316 KB Output is correct
24 Correct 7 ms 10444 KB Output is correct
25 Correct 11 ms 10956 KB Output is correct
26 Correct 14 ms 11264 KB Output is correct
27 Correct 16 ms 11540 KB Output is correct
28 Correct 725 ms 46800 KB Output is correct
29 Correct 1166 ms 64764 KB Output is correct
30 Correct 1811 ms 83432 KB Output is correct
31 Correct 2268 ms 101348 KB Output is correct
32 Correct 8 ms 10444 KB Output is correct
33 Correct 7 ms 10444 KB Output is correct
34 Correct 7 ms 10444 KB Output is correct
35 Correct 7 ms 10444 KB Output is correct
36 Correct 7 ms 10444 KB Output is correct
37 Correct 8 ms 10372 KB Output is correct
38 Correct 8 ms 10444 KB Output is correct
39 Correct 7 ms 10444 KB Output is correct
40 Correct 7 ms 10444 KB Output is correct
41 Correct 7 ms 10444 KB Output is correct
42 Correct 7 ms 10444 KB Output is correct
43 Correct 10 ms 10828 KB Output is correct
44 Correct 12 ms 11084 KB Output is correct
45 Correct 832 ms 53300 KB Output is correct
46 Correct 1391 ms 73368 KB Output is correct
47 Correct 1333 ms 73056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10444 KB Output is correct
2 Correct 7 ms 10444 KB Output is correct
3 Correct 7 ms 10444 KB Output is correct
4 Correct 8 ms 10444 KB Output is correct
5 Correct 7 ms 10444 KB Output is correct
6 Correct 7 ms 10444 KB Output is correct
7 Correct 7 ms 10444 KB Output is correct
8 Correct 7 ms 10444 KB Output is correct
9 Correct 434 ms 38076 KB Output is correct
10 Correct 27 ms 13260 KB Output is correct
11 Correct 136 ms 25280 KB Output is correct
12 Correct 40 ms 14572 KB Output is correct
13 Correct 89 ms 19692 KB Output is correct
14 Correct 8 ms 10624 KB Output is correct
15 Correct 10 ms 10876 KB Output is correct
16 Correct 410 ms 38044 KB Output is correct
17 Correct 8 ms 10444 KB Output is correct
18 Correct 8 ms 10444 KB Output is correct
19 Correct 8 ms 10444 KB Output is correct
20 Correct 7 ms 10444 KB Output is correct
21 Correct 7 ms 10444 KB Output is correct
22 Correct 7 ms 10444 KB Output is correct
23 Correct 2238 ms 101316 KB Output is correct
24 Correct 7 ms 10444 KB Output is correct
25 Correct 11 ms 10956 KB Output is correct
26 Correct 14 ms 11264 KB Output is correct
27 Correct 16 ms 11540 KB Output is correct
28 Correct 725 ms 46800 KB Output is correct
29 Correct 1166 ms 64764 KB Output is correct
30 Correct 1811 ms 83432 KB Output is correct
31 Correct 2268 ms 101348 KB Output is correct
32 Correct 8 ms 10444 KB Output is correct
33 Correct 7 ms 10444 KB Output is correct
34 Correct 7 ms 10444 KB Output is correct
35 Correct 7 ms 10444 KB Output is correct
36 Correct 7 ms 10444 KB Output is correct
37 Correct 8 ms 10372 KB Output is correct
38 Correct 8 ms 10444 KB Output is correct
39 Correct 7 ms 10444 KB Output is correct
40 Correct 7 ms 10444 KB Output is correct
41 Correct 7 ms 10444 KB Output is correct
42 Correct 7 ms 10444 KB Output is correct
43 Correct 10 ms 10828 KB Output is correct
44 Correct 12 ms 11084 KB Output is correct
45 Correct 832 ms 53300 KB Output is correct
46 Correct 1391 ms 73368 KB Output is correct
47 Correct 1333 ms 73056 KB Output is correct
48 Correct 8 ms 10444 KB Output is correct
49 Correct 7 ms 10444 KB Output is correct
50 Correct 8 ms 10424 KB Output is correct
51 Correct 7 ms 10444 KB Output is correct
52 Correct 7 ms 10444 KB Output is correct
53 Correct 7 ms 10368 KB Output is correct
54 Correct 7 ms 10444 KB Output is correct
55 Correct 2391 ms 98548 KB Output is correct
56 Correct 8 ms 10444 KB Output is correct
57 Correct 16 ms 11200 KB Output is correct
58 Correct 34 ms 13124 KB Output is correct
59 Correct 36 ms 13364 KB Output is correct
60 Correct 998 ms 54336 KB Output is correct
61 Correct 1450 ms 71144 KB Output is correct
62 Correct 1874 ms 84592 KB Output is correct
63 Correct 2439 ms 98692 KB Output is correct
64 Correct 7 ms 10444 KB Output is correct
65 Correct 7 ms 10444 KB Output is correct
66 Correct 8 ms 10440 KB Output is correct
67 Correct 1029 ms 65968 KB Output is correct
68 Correct 993 ms 66052 KB Output is correct
69 Correct 1065 ms 65852 KB Output is correct
70 Correct 14 ms 11284 KB Output is correct
71 Correct 23 ms 12076 KB Output is correct
72 Correct 797 ms 49636 KB Output is correct
73 Correct 1488 ms 70064 KB Output is correct
74 Correct 2044 ms 89372 KB Output is correct
75 Correct 2033 ms 90500 KB Output is correct
76 Correct 1014 ms 66112 KB Output is correct
77 Correct 16 ms 11596 KB Output is correct
78 Correct 27 ms 12396 KB Output is correct
79 Correct 919 ms 52376 KB Output is correct
80 Correct 1436 ms 74048 KB Output is correct
81 Correct 2079 ms 94644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10444 KB Output is correct
2 Correct 7 ms 10444 KB Output is correct
3 Correct 7 ms 10444 KB Output is correct
4 Correct 8 ms 10444 KB Output is correct
5 Correct 7 ms 10444 KB Output is correct
6 Correct 7 ms 10444 KB Output is correct
7 Correct 7 ms 10444 KB Output is correct
8 Correct 7 ms 10444 KB Output is correct
9 Correct 434 ms 38076 KB Output is correct
10 Correct 27 ms 13260 KB Output is correct
11 Correct 136 ms 25280 KB Output is correct
12 Correct 40 ms 14572 KB Output is correct
13 Correct 89 ms 19692 KB Output is correct
14 Correct 8 ms 10624 KB Output is correct
15 Correct 10 ms 10876 KB Output is correct
16 Correct 410 ms 38044 KB Output is correct
17 Correct 7 ms 10444 KB Output is correct
18 Correct 7 ms 10480 KB Output is correct
19 Correct 7 ms 10444 KB Output is correct
20 Incorrect 2483 ms 108980 KB Tree @(7, 199997) appears more than once: for edges on positions 0 and 1440
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10444 KB Output is correct
2 Correct 7 ms 10444 KB Output is correct
3 Correct 7 ms 10444 KB Output is correct
4 Correct 8 ms 10444 KB Output is correct
5 Correct 7 ms 10444 KB Output is correct
6 Correct 7 ms 10444 KB Output is correct
7 Correct 7 ms 10444 KB Output is correct
8 Correct 7 ms 10444 KB Output is correct
9 Correct 434 ms 38076 KB Output is correct
10 Correct 27 ms 13260 KB Output is correct
11 Correct 136 ms 25280 KB Output is correct
12 Correct 40 ms 14572 KB Output is correct
13 Correct 89 ms 19692 KB Output is correct
14 Correct 8 ms 10624 KB Output is correct
15 Correct 10 ms 10876 KB Output is correct
16 Correct 410 ms 38044 KB Output is correct
17 Correct 1628 ms 97092 KB Output is correct
18 Correct 1812 ms 102224 KB Output is correct
19 Incorrect 2542 ms 108644 KB Tree @(7, 50005) appears more than once: for edges on positions 1 and 29824
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10444 KB Output is correct
2 Correct 7 ms 10444 KB Output is correct
3 Correct 7 ms 10444 KB Output is correct
4 Correct 8 ms 10444 KB Output is correct
5 Correct 7 ms 10444 KB Output is correct
6 Correct 7 ms 10444 KB Output is correct
7 Correct 7 ms 10444 KB Output is correct
8 Correct 7 ms 10444 KB Output is correct
9 Correct 434 ms 38076 KB Output is correct
10 Correct 27 ms 13260 KB Output is correct
11 Correct 136 ms 25280 KB Output is correct
12 Correct 40 ms 14572 KB Output is correct
13 Correct 89 ms 19692 KB Output is correct
14 Correct 8 ms 10624 KB Output is correct
15 Correct 10 ms 10876 KB Output is correct
16 Correct 410 ms 38044 KB Output is correct
17 Correct 8 ms 10444 KB Output is correct
18 Correct 8 ms 10444 KB Output is correct
19 Correct 8 ms 10444 KB Output is correct
20 Correct 7 ms 10444 KB Output is correct
21 Correct 7 ms 10444 KB Output is correct
22 Correct 7 ms 10444 KB Output is correct
23 Correct 2238 ms 101316 KB Output is correct
24 Correct 7 ms 10444 KB Output is correct
25 Correct 11 ms 10956 KB Output is correct
26 Correct 14 ms 11264 KB Output is correct
27 Correct 16 ms 11540 KB Output is correct
28 Correct 725 ms 46800 KB Output is correct
29 Correct 1166 ms 64764 KB Output is correct
30 Correct 1811 ms 83432 KB Output is correct
31 Correct 2268 ms 101348 KB Output is correct
32 Correct 8 ms 10444 KB Output is correct
33 Correct 7 ms 10444 KB Output is correct
34 Correct 7 ms 10444 KB Output is correct
35 Correct 7 ms 10444 KB Output is correct
36 Correct 7 ms 10444 KB Output is correct
37 Correct 8 ms 10372 KB Output is correct
38 Correct 8 ms 10444 KB Output is correct
39 Correct 7 ms 10444 KB Output is correct
40 Correct 7 ms 10444 KB Output is correct
41 Correct 7 ms 10444 KB Output is correct
42 Correct 7 ms 10444 KB Output is correct
43 Correct 10 ms 10828 KB Output is correct
44 Correct 12 ms 11084 KB Output is correct
45 Correct 832 ms 53300 KB Output is correct
46 Correct 1391 ms 73368 KB Output is correct
47 Correct 1333 ms 73056 KB Output is correct
48 Correct 8 ms 10444 KB Output is correct
49 Correct 7 ms 10444 KB Output is correct
50 Correct 8 ms 10424 KB Output is correct
51 Correct 7 ms 10444 KB Output is correct
52 Correct 7 ms 10444 KB Output is correct
53 Correct 7 ms 10368 KB Output is correct
54 Correct 7 ms 10444 KB Output is correct
55 Correct 2391 ms 98548 KB Output is correct
56 Correct 8 ms 10444 KB Output is correct
57 Correct 16 ms 11200 KB Output is correct
58 Correct 34 ms 13124 KB Output is correct
59 Correct 36 ms 13364 KB Output is correct
60 Correct 998 ms 54336 KB Output is correct
61 Correct 1450 ms 71144 KB Output is correct
62 Correct 1874 ms 84592 KB Output is correct
63 Correct 2439 ms 98692 KB Output is correct
64 Correct 7 ms 10444 KB Output is correct
65 Correct 7 ms 10444 KB Output is correct
66 Correct 8 ms 10440 KB Output is correct
67 Correct 1029 ms 65968 KB Output is correct
68 Correct 993 ms 66052 KB Output is correct
69 Correct 1065 ms 65852 KB Output is correct
70 Correct 14 ms 11284 KB Output is correct
71 Correct 23 ms 12076 KB Output is correct
72 Correct 797 ms 49636 KB Output is correct
73 Correct 1488 ms 70064 KB Output is correct
74 Correct 2044 ms 89372 KB Output is correct
75 Correct 2033 ms 90500 KB Output is correct
76 Correct 1014 ms 66112 KB Output is correct
77 Correct 16 ms 11596 KB Output is correct
78 Correct 27 ms 12396 KB Output is correct
79 Correct 919 ms 52376 KB Output is correct
80 Correct 1436 ms 74048 KB Output is correct
81 Correct 2079 ms 94644 KB Output is correct
82 Correct 7 ms 10444 KB Output is correct
83 Correct 7 ms 10480 KB Output is correct
84 Correct 7 ms 10444 KB Output is correct
85 Incorrect 2483 ms 108980 KB Tree @(7, 199997) appears more than once: for edges on positions 0 and 1440
86 Halted 0 ms 0 KB -