답안 #1034102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1034102 2024-07-25T09:48:43 Z hotboy2703 분수 공원 (IOI21_parks) C++17
70 / 100
523 ms 145404 KB
#include "parks.h"

#include<bits/stdc++.h>
using ll = int;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define MASK(i) (1LL<<(i))
#define BIT(mask,i) (((mask) >> (i))&1)
struct point{
    ll x,y,id;
    point(ll x1 = 0,ll y1 = 0,ll id1 = 0):x(x1),y(y1),id(id1){}
    bool operator < (const point &p)const {
        return MP(x,y) < MP(p.x,p.y);
    }
};
namespace sub1{
    ll solve(vector <ll> x,vector <ll> y){
        for (auto z:x)if (z > 6 || z < 2)return -1;
        ll n = sz(x);
        vector <pll> all[7];
        vector <point> a(n);
        
        for (ll i = 0;i < n;i ++){
            a[i] = {x[i],y[i],i};
        }
        sort(a.begin(),a.end());
        for (ll i = 0;i < n;i ++){
            if (all[a[i].x].empty() || all[a[i].x].back().se + 2 != a[i].y)all[a[i].x].push_back(MP(a[i].y,a[i].y));
            else{
                all[a[i].x].back().se+=2;
            }
        }
        vector <int> U, V, A, B;
        auto add = [&](pll u,pll v, ll x,ll y){
            // cout<<u.fi<<' '<<u.se<<' '<<v.fi<<' '<<v.se<<endl;
            U.push_back((*lower_bound(a.begin(),a.end(),point(u.fi,u.se,0))).id);
            V.push_back((*lower_bound(a.begin(),a.end(),point(v.fi,v.se,0))).id);
            A.push_back(x);
            B.push_back(y);
        };
        for (auto x:all[2]){
            for (ll i = x.fi + 2;i <= x.se;i += 2){
                add(MP(2,i-2),MP(2,i),1,i-1);
            }
        }
        for (auto x:all[4]){
            static ll ptr2 = 0;
            static ll ptr6 = 0;
            vector <ll> sus2,sus6;
            while (ptr2 < sz(all[2]) && all[2][ptr2].se < x.fi)ptr2++;
            while (ptr2 < sz(all[2]) && all[2][ptr2].fi <= x.se){
                // cout<<all[2][ptr2].fi<<' '<<all[2][ptr2].se<<endl;
                pll tmp = all[2][ptr2];
                if (tmp.fi <= x.fi && x.fi <= tmp.se){
                    add(MP(4,x.fi),MP(2,x.fi),3,x.fi-1);
                }
                else if (tmp.fi <= x.se && x.se <= tmp.se){
                    add(MP(4,x.se),MP(2,x.se),3,x.se+1);
                }
                else{
                    sus2.push_back(tmp.fi);
                }
                ptr2++;
            }
 
            while (ptr6 < sz(all[6]) && all[6][ptr6].se < x.fi)ptr6++;
            while (ptr6 < sz(all[6]) && all[6][ptr6].fi <= x.se){
                pll tmp = all[6][ptr6];
                if (tmp.fi <= x.fi && x.fi <= tmp.se){
                    add(MP(4,x.fi),MP(6,x.fi),5,x.fi-1);
                }
                else if (tmp.fi <= x.se && x.se <= tmp.se){
                    add(MP(4,x.se),MP(6,x.se),5,x.se+1);
                }
                else{
                    sus6.push_back(tmp.fi);
                }
                ptr6++;
            }
            ptr2=0,ptr6=0;
            for (ll j = x.fi + 2;j <= x.se;j += 2){
                while(ptr2 < sz(sus2) && sus2[ptr2]<j)ptr2++; 
                while(ptr6 < sz(sus6) && sus6[ptr6]<j)ptr6++; 
                bool do2,do6;
                do2 =  (ptr2 < sz(sus2) && sus2[ptr2]==j);
                do6 =  (ptr6 < sz(sus6) && sus6[ptr6]==j);
                if (do2 && do6){
                    add(MP(4,j),MP(2,j),3,j-1);
                    add(MP(4,j),MP(6,j),5,j+1);
                    add(MP(4,j),MP(4,j-2),5,j-1);
                    add(MP(4,j),MP(4,j+2),3,j+1);
                    j+=2;
                }
                else if (do2){
                    add(MP(4,j),MP(2,j),3,j-1);
                    add(MP(4,j),MP(4,j-2),5,j-1);
                }
                else if (do6){
                    add(MP(4,j),MP(6,j),5,j-1);
                    add(MP(4,j),MP(4,j-2),3,j-1);
                }
                else add(MP(4,j),MP(4,j-2),3,j-1);
            }
        } 
        for (auto x:all[6]){
            for (ll i = x.fi + 2;i <= x.se;i += 2){
                add(MP(6,i-2),MP(6,i),7,i-1);
            }
        }
        {
            vector <vector <ll > > g(n);
            for (ll i = 0;i < sz(U);i ++){
                g[U[i]].push_back(V[i]);
                g[V[i]].push_back(U[i]);
            }
            vector <bool> in(n);
            queue <ll> q;
            q.push(0);
            in[0] = 1;
            while (!q.empty()){
                ll u = q.front();
                q.pop();
                for (auto v:g[u]){
                    if (!in[v]){
                        in[v] = 1;
                        q.push(v);
                    }
                }
            }
            for (ll i = 0;i < n;i ++)if (!in[i])return 0;
            build(U, V, A, B);
            return 1;
        }
    }
}
const ll MAXN = 2e5+100;
ll dsu[MAXN];
ll f(ll x){
    if (dsu[x] < 0)return x;
    return (dsu[x] = f(dsu[x]));
}
bool join(ll x,ll y){
    x = f(x),y = f(y);
    if (x==y)return 0;
    dsu[x] += dsu[y];
    dsu[y] = x;
    return 1;
}
struct road{
    pll a,b;
    ll id;
};
namespace scc{
    vector <pair <pll,bool> > query;
    void add_or(ll x,ll y,bool neg = 0){
        // cout<<x<<' '<<y<<'\n';
        query.push_back(MP(MP(x,y),neg));
    }
    vector <vector <ll> > g1,g2;
    vector <bool> in;
    void add(ll x,ll y){
        g1[x].push_back(y);
        g2[y].push_back(x);
    }
    void dfs(vector <vector <ll> > &adj,ll u,vector <ll> &order){
        in[u] = 1;
        for (auto v:adj[u]){
            if (!in[v]){
                dfs(adj,v,order);
            }
        }
        order.push_back(u);
    }
    bool solve(vector <bool> &res){
        ll n=sz(res)*2;
        g1.resize(n);
        g2.resize(n);
        for (auto x:query){
            if (x.se){ 
                add(x.fi.fi<<1,x.fi.se<<1|1);
                add(x.fi.se<<1,x.fi.fi<<1|1);
            }
            else{
                add(x.fi.fi<<1|1,x.fi.se<<1);
                add(x.fi.se<<1|1,x.fi.fi<<1);
            }
        }
        vector <ll> order;
        in = vector <bool> (n,0);
        vector <ll> c(n);
        for (ll i = 0;i < n;i ++){
            if (!in[i]){
                dfs(g1,i,order);
            }
        }
        in = vector <bool> (n,0);
        reverse(order.begin(),order.end());
        ll ptr = 0;
        for (auto x:order){
            if (!in[x]) {
                vector <ll> comp;
                dfs(g2,x,comp);
                for (auto x:comp)c[x] = ptr;
                ptr++;
            }
        }
        for (ll i = 0;i < sz(res);i ++){
            if (c[i<<1]==c[i<<1|1])return 0;
            res[i] = c[i<<1] > c[i<<1|1];
            // cout<<res[i]<<' ';
        }
        // cout<<'\n';
        return 1;
    }
}
int construct_roads(std::vector<int> x, std::vector<int> y) {
    ll tmp = sub1::solve(x,y);
    if (tmp != -1)return tmp;
    ll n = sz(x);
    vector <point> a(n);
    
    for (ll i = 0;i < n;i ++){
        dsu[i] = -1;
        a[i] = {x[i],y[i],i};
    }
    sort(a.begin(),a.end());
    auto id = [&](pll x){
        auto tmp = lower_bound(a.begin(),a.end(),point(x.fi,x.se,0));
        if (tmp != a.end() && (*tmp).x==x.fi&&(*tmp).y==x.se)return (*tmp).id;
        else return -1;
    };
    vector <road> all;
    for (ll i = 0;i < n;i ++){
        if (id(MP(a[i].x,a[i].y-2)) != -1) {
            if (join(id(MP(a[i].x,a[i].y-2)),a[i].id)) {
                all.push_back({MP(id(MP(a[i].x,a[i].y-2)),a[i].id),MP(a[i].x-1,a[i].y-1),sz(all)});
                all.push_back({MP(id(MP(a[i].x,a[i].y-2)),a[i].id),MP(a[i].x+1,a[i].y-1),sz(all)});
                scc::add_or(sz(all)-1,sz(all)-2);
                scc::add_or(sz(all)-1,sz(all)-2,1);
            }
        }
        if ((id(MP(a[i].x-2,a[i].y)) != -1)) {
            if (join(id(MP(a[i].x-2,a[i].y)),a[i].id)) {
                all.push_back({MP(id(MP(a[i].x-2,a[i].y)),a[i].id),MP(a[i].x-1,a[i].y+1),sz(all)});
                all.push_back({MP(id(MP(a[i].x-2,a[i].y)),a[i].id),MP(a[i].x-1,a[i].y-1),sz(all)});
                scc::add_or(sz(all)-1,sz(all)-2);
                scc::add_or(sz(all)-1,sz(all)-2,1);
            }
        }
    }
    if (dsu[f(0)] != -n)return 0;
    sort(all.begin(),all.end(),[](road a1,road a2){return a1.b < a2.b;});
    for (ll i = 0;i + 1 < sz(all);i ++){
        if (all[i].b == all[i+1].b){
            // cout<<all[i].a.fi<<' '<<all[i].a.se<<' '<<all[i+1].a.fi<<' '<<all[i+1].a.se<<' '<<all[i].id<<' '<<all[i+1].id<<endl;
            scc::add_or(all[i].id,all[i+1].id,1);
        }
    }
    vector <bool> res(sz(all));
    if (!scc::solve(res))return 0;

    {
        vector <ll> U,V,A,B;
        for (ll i = 0;i < sz(all);i ++){
            if (res[all[i].id]){
                U.push_back(all[i].a.fi);
                V.push_back(all[i].a.se);
                A.push_back(all[i].b.fi);
                B.push_back(all[i].b.se);
            }
        }
        build(U, V, A, B);
        return 1;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 69 ms 14012 KB Output is correct
10 Correct 5 ms 1644 KB Output is correct
11 Correct 27 ms 7728 KB Output is correct
12 Correct 7 ms 2396 KB Output is correct
13 Correct 14 ms 4972 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 61 ms 14012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 69 ms 14012 KB Output is correct
10 Correct 5 ms 1644 KB Output is correct
11 Correct 27 ms 7728 KB Output is correct
12 Correct 7 ms 2396 KB Output is correct
13 Correct 14 ms 4972 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 61 ms 14012 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 129 ms 27864 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 50 ms 11268 KB Output is correct
29 Correct 93 ms 16824 KB Output is correct
30 Correct 108 ms 22692 KB Output is correct
31 Correct 137 ms 27768 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 400 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 142 ms 14268 KB Output is correct
46 Correct 264 ms 20708 KB Output is correct
47 Correct 276 ms 20660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 69 ms 14012 KB Output is correct
10 Correct 5 ms 1644 KB Output is correct
11 Correct 27 ms 7728 KB Output is correct
12 Correct 7 ms 2396 KB Output is correct
13 Correct 14 ms 4972 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 61 ms 14012 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 129 ms 27864 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 50 ms 11268 KB Output is correct
29 Correct 93 ms 16824 KB Output is correct
30 Correct 108 ms 22692 KB Output is correct
31 Correct 137 ms 27768 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 400 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 142 ms 14268 KB Output is correct
46 Correct 264 ms 20708 KB Output is correct
47 Correct 276 ms 20660 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 0 ms 344 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 141 ms 27820 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 2 ms 604 KB Output is correct
58 Correct 7 ms 1228 KB Output is correct
59 Correct 7 ms 1628 KB Output is correct
60 Correct 70 ms 14692 KB Output is correct
61 Correct 83 ms 19880 KB Output is correct
62 Correct 110 ms 24328 KB Output is correct
63 Correct 122 ms 29464 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 127 ms 29460 KB Output is correct
68 Correct 128 ms 29352 KB Output is correct
69 Correct 119 ms 29168 KB Output is correct
70 Correct 2 ms 856 KB Output is correct
71 Correct 4 ms 1372 KB Output is correct
72 Correct 142 ms 15092 KB Output is correct
73 Correct 302 ms 22624 KB Output is correct
74 Correct 396 ms 30004 KB Output is correct
75 Correct 166 ms 31552 KB Output is correct
76 Correct 141 ms 29356 KB Output is correct
77 Correct 3 ms 856 KB Output is correct
78 Correct 7 ms 1372 KB Output is correct
79 Correct 125 ms 15496 KB Output is correct
80 Correct 250 ms 23244 KB Output is correct
81 Correct 420 ms 30928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 69 ms 14012 KB Output is correct
10 Correct 5 ms 1644 KB Output is correct
11 Correct 27 ms 7728 KB Output is correct
12 Correct 7 ms 2396 KB Output is correct
13 Correct 14 ms 4972 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 61 ms 14012 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 335 ms 145224 KB Output is correct
21 Correct 375 ms 132696 KB Output is correct
22 Correct 404 ms 132748 KB Output is correct
23 Correct 228 ms 101368 KB Output is correct
24 Correct 76 ms 6592 KB Output is correct
25 Correct 91 ms 21532 KB Output is correct
26 Correct 101 ms 21536 KB Output is correct
27 Correct 279 ms 118028 KB Output is correct
28 Correct 391 ms 118020 KB Output is correct
29 Correct 279 ms 117924 KB Output is correct
30 Correct 271 ms 118028 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 35 ms 8632 KB Output is correct
33 Correct 29 ms 3400 KB Output is correct
34 Correct 370 ms 145404 KB Output is correct
35 Correct 5 ms 1712 KB Output is correct
36 Correct 24 ms 5572 KB Output is correct
37 Correct 54 ms 10932 KB Output is correct
38 Correct 140 ms 49016 KB Output is correct
39 Correct 220 ms 65868 KB Output is correct
40 Correct 245 ms 86068 KB Output is correct
41 Correct 310 ms 102792 KB Output is correct
42 Correct 490 ms 119804 KB Output is correct
43 Correct 0 ms 344 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 0 ms 344 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 1 ms 344 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 2 ms 604 KB Output is correct
55 Correct 1 ms 604 KB Output is correct
56 Correct 206 ms 14316 KB Output is correct
57 Correct 323 ms 20472 KB Output is correct
58 Correct 334 ms 20664 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 155 ms 27808 KB Output is correct
63 Correct 150 ms 27708 KB Output is correct
64 Correct 160 ms 27592 KB Output is correct
65 Correct 2 ms 860 KB Output is correct
66 Correct 5 ms 1116 KB Output is correct
67 Correct 154 ms 14360 KB Output is correct
68 Correct 314 ms 21304 KB Output is correct
69 Correct 523 ms 28212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 69 ms 14012 KB Output is correct
10 Correct 5 ms 1644 KB Output is correct
11 Correct 27 ms 7728 KB Output is correct
12 Correct 7 ms 2396 KB Output is correct
13 Correct 14 ms 4972 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 61 ms 14012 KB Output is correct
17 Correct 307 ms 117912 KB Output is correct
18 Correct 251 ms 118024 KB Output is correct
19 Correct 401 ms 132752 KB Output is correct
20 Correct 345 ms 117336 KB Output is correct
21 Correct 265 ms 104704 KB Output is correct
22 Correct 1 ms 600 KB Output is correct
23 Correct 57 ms 18736 KB Output is correct
24 Correct 11 ms 2696 KB Output is correct
25 Correct 47 ms 9432 KB Output is correct
26 Correct 88 ms 12296 KB Output is correct
27 Correct 191 ms 60060 KB Output is correct
28 Correct 211 ms 74056 KB Output is correct
29 Correct 297 ms 91652 KB Output is correct
30 Correct 311 ms 105608 KB Output is correct
31 Correct 334 ms 119496 KB Output is correct
32 Correct 134 ms 30020 KB Output is correct
33 Correct 174 ms 27800 KB Output is correct
34 Correct 2 ms 860 KB Output is correct
35 Correct 5 ms 1372 KB Output is correct
36 Correct 123 ms 14856 KB Output is correct
37 Correct 280 ms 21984 KB Output is correct
38 Correct 384 ms 29288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 69 ms 14012 KB Output is correct
10 Correct 5 ms 1644 KB Output is correct
11 Correct 27 ms 7728 KB Output is correct
12 Correct 7 ms 2396 KB Output is correct
13 Correct 14 ms 4972 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 61 ms 14012 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 129 ms 27864 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 50 ms 11268 KB Output is correct
29 Correct 93 ms 16824 KB Output is correct
30 Correct 108 ms 22692 KB Output is correct
31 Correct 137 ms 27768 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 400 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 142 ms 14268 KB Output is correct
46 Correct 264 ms 20708 KB Output is correct
47 Correct 276 ms 20660 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 0 ms 344 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 141 ms 27820 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 2 ms 604 KB Output is correct
58 Correct 7 ms 1228 KB Output is correct
59 Correct 7 ms 1628 KB Output is correct
60 Correct 70 ms 14692 KB Output is correct
61 Correct 83 ms 19880 KB Output is correct
62 Correct 110 ms 24328 KB Output is correct
63 Correct 122 ms 29464 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 127 ms 29460 KB Output is correct
68 Correct 128 ms 29352 KB Output is correct
69 Correct 119 ms 29168 KB Output is correct
70 Correct 2 ms 856 KB Output is correct
71 Correct 4 ms 1372 KB Output is correct
72 Correct 142 ms 15092 KB Output is correct
73 Correct 302 ms 22624 KB Output is correct
74 Correct 396 ms 30004 KB Output is correct
75 Correct 166 ms 31552 KB Output is correct
76 Correct 141 ms 29356 KB Output is correct
77 Correct 3 ms 856 KB Output is correct
78 Correct 7 ms 1372 KB Output is correct
79 Correct 125 ms 15496 KB Output is correct
80 Correct 250 ms 23244 KB Output is correct
81 Correct 420 ms 30928 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 335 ms 145224 KB Output is correct
86 Correct 375 ms 132696 KB Output is correct
87 Correct 404 ms 132748 KB Output is correct
88 Correct 228 ms 101368 KB Output is correct
89 Correct 76 ms 6592 KB Output is correct
90 Correct 91 ms 21532 KB Output is correct
91 Correct 101 ms 21536 KB Output is correct
92 Correct 279 ms 118028 KB Output is correct
93 Correct 391 ms 118020 KB Output is correct
94 Correct 279 ms 117924 KB Output is correct
95 Correct 271 ms 118028 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 35 ms 8632 KB Output is correct
98 Correct 29 ms 3400 KB Output is correct
99 Correct 370 ms 145404 KB Output is correct
100 Correct 5 ms 1712 KB Output is correct
101 Correct 24 ms 5572 KB Output is correct
102 Correct 54 ms 10932 KB Output is correct
103 Correct 140 ms 49016 KB Output is correct
104 Correct 220 ms 65868 KB Output is correct
105 Correct 245 ms 86068 KB Output is correct
106 Correct 310 ms 102792 KB Output is correct
107 Correct 490 ms 119804 KB Output is correct
108 Correct 0 ms 344 KB Output is correct
109 Correct 1 ms 348 KB Output is correct
110 Correct 0 ms 348 KB Output is correct
111 Correct 1 ms 344 KB Output is correct
112 Correct 0 ms 344 KB Output is correct
113 Correct 1 ms 348 KB Output is correct
114 Correct 1 ms 348 KB Output is correct
115 Correct 0 ms 348 KB Output is correct
116 Correct 1 ms 344 KB Output is correct
117 Correct 1 ms 344 KB Output is correct
118 Correct 0 ms 348 KB Output is correct
119 Correct 2 ms 604 KB Output is correct
120 Correct 1 ms 604 KB Output is correct
121 Correct 206 ms 14316 KB Output is correct
122 Correct 323 ms 20472 KB Output is correct
123 Correct 334 ms 20664 KB Output is correct
124 Correct 0 ms 348 KB Output is correct
125 Correct 0 ms 348 KB Output is correct
126 Correct 0 ms 348 KB Output is correct
127 Correct 155 ms 27808 KB Output is correct
128 Correct 150 ms 27708 KB Output is correct
129 Correct 160 ms 27592 KB Output is correct
130 Correct 2 ms 860 KB Output is correct
131 Correct 5 ms 1116 KB Output is correct
132 Correct 154 ms 14360 KB Output is correct
133 Correct 314 ms 21304 KB Output is correct
134 Correct 523 ms 28212 KB Output is correct
135 Correct 307 ms 117912 KB Output is correct
136 Correct 251 ms 118024 KB Output is correct
137 Correct 401 ms 132752 KB Output is correct
138 Correct 345 ms 117336 KB Output is correct
139 Correct 265 ms 104704 KB Output is correct
140 Correct 1 ms 600 KB Output is correct
141 Correct 57 ms 18736 KB Output is correct
142 Correct 11 ms 2696 KB Output is correct
143 Correct 47 ms 9432 KB Output is correct
144 Correct 88 ms 12296 KB Output is correct
145 Correct 191 ms 60060 KB Output is correct
146 Correct 211 ms 74056 KB Output is correct
147 Correct 297 ms 91652 KB Output is correct
148 Correct 311 ms 105608 KB Output is correct
149 Correct 334 ms 119496 KB Output is correct
150 Correct 134 ms 30020 KB Output is correct
151 Correct 174 ms 27800 KB Output is correct
152 Correct 2 ms 860 KB Output is correct
153 Correct 5 ms 1372 KB Output is correct
154 Correct 123 ms 14856 KB Output is correct
155 Correct 280 ms 21984 KB Output is correct
156 Correct 384 ms 29288 KB Output is correct
157 Correct 0 ms 344 KB Output is correct
158 Correct 1 ms 348 KB Output is correct
159 Correct 0 ms 452 KB Output is correct
160 Correct 0 ms 604 KB Output is correct
161 Incorrect 452 ms 122340 KB Tree @(1013, 1001) appears more than once: for edges on positions 3000 and 3001
162 Halted 0 ms 0 KB -