답안 #788527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
788527 2023-07-20T10:22:28 Z alexander707070 분수 공원 (IOI21_parks) C++17
70 / 100
1114 ms 178456 KB
#include<bits/stdc++.h>
#include "parks.h"
#define MAXN 800007
using namespace std;

struct bench{
    int from,to;
    int a,b;
};

int n,curr,benches,br,k,comp[MAXN],ans[MAXN],dsu[MAXN],w[MAXN];
bool li[MAXN];
vector<int> v[MAXN],r[MAXN];
stack<int> st;

vector<bench> sol;
vector<int> A,B,C,D;
vector< pair<int,int> > ors;

unordered_map<long long, int> mp;
map< pair<int,int>, vector<int> > bro;

int op(int x){
    if(x<400000)return x+400000;
    return x-400000;
}

void add(int x,int y,int z){
    for(int i=0;i<bro[{x,y}].size();i++){
        ors.push_back({op(bro[{x,y}][i]),op(z)});
    }
    bro[{x,y}].push_back(z);
}

void dfs(int x){
    li[x]=true;
    for(int i=0;i<v[x].size();i++){
        if(!li[v[x][i]])dfs(v[x][i]);
    }
    st.push(x);
}

void scc(int x){
    comp[x]=k;
    li[x]=true;

    for(int i=0;i<r[x].size();i++){
        if(!li[r[x][i]])scc(r[x][i]);
    }
}

int root(int x){
    if(dsu[x]==x)return x;
    dsu[x]=root(dsu[x]);
    return dsu[x];
}

void mergev(int x,int y){
    dsu[root(x)]=root(y);
}

vector<long long> x,y;

int construct_roads(vector<int> X,vector<int> Y){
    n=int(X.size());
    x.resize(n); y.resize(n);

    for(int i=0;i<n;i++){
        dsu[i]=i; x[i]=X[i]; y[i]=Y[i];
        mp[x[i]*300000+y[i]]=i+1;
    }

    br=0;
    for(int i=0;i<n;i++){
        curr=mp[x[i]*300000+y[i]-2];
        if(curr!=0 and root(i)!=root(curr-1)){
            curr--; mergev(i,curr);

            add(x[i]-1,y[i]-1,br);
            add(x[i]+1,y[i]-1,br+1);
            ors.push_back({br,br+1});

            br+=2;
        }
    }

    for(int i=0;i<n;i++){
        curr=mp[(x[i]-2)*300000+y[i]];
        if(curr!=0 and root(i)!=root(curr-1)){
            curr--; mergev(i,curr);

            add(x[i]-1,y[i]-1,br);
            add(x[i]-1,y[i]+1,br+1);
            ors.push_back({br,br+1});
            
            br+=2;
        }
    } 

    if(br!=2*n-2)return 0;

    for(int i=0;i<ors.size();i++){
        v[op(ors[i].first)].push_back(ors[i].second);
        r[ors[i].second].push_back(op(ors[i].first));

        v[op(ors[i].second)].push_back(ors[i].first);
        r[ors[i].first].push_back(op(ors[i].second));
    }

    for(int i=0;i<800000;i++){
        if(!li[i])dfs(i);
    }
    for(int i=0;i<800000;i++)li[i]=false;
    while(!st.empty()){
        if(!li[st.top()]){
            k++; scc(st.top());
        }
        st.pop();
    }

    for(int i=0;i<br;i++){
        if(comp[i]==comp[op(i)])return 0;
        if(comp[i]<comp[op(i)])ans[i]=0;
        else ans[i]=1;
    }

    for(int i=0;i<n;i++)dsu[i]=i;

    br=0;
    for(int i=0;i<n;i++){
        curr=mp[x[i]*300000+y[i]-2];
        if(curr!=0 and root(i)!=root(curr-1)){
            curr--; mergev(i,curr);

            if(ans[br]==0 and ans[br+1]==0)return -1;
            if(ans[br]==1){
                sol.push_back({curr,i,x[i]-1,y[i]-1});
            }else{
                sol.push_back({curr,i,x[i]+1,y[i]-1});
            }

            br+=2;
        }
    }

    for(int i=0;i<n;i++){
        curr=mp[(x[i]-2)*300000+y[i]];
        if(curr!=0 and root(i)!=root(curr-1)){
            curr--; mergev(i,curr);
        
            if(ans[br]==0 and ans[br+1]==0)return -1;
            if(ans[br]==1){
                sol.push_back({curr,i,x[i]-1,y[i]-1});
            }else{
                sol.push_back({curr,i,x[i]-1,y[i]+1});
            }
            
            br+=2;
        }
    }
    
    for(int i=0;i<sol.size();i++){
        A.push_back(sol[i].from);
        B.push_back(sol[i].to);
        C.push_back(sol[i].a);
        D.push_back(sol[i].b);
    }

    build(A,B,C,D);
    return 1;
}

/*
int main(){
    cout<<construct_roads({4, 4, 6, 4, 2}, {4, 6, 4, 2, 4});
}
*/




Compilation message

parks.cpp: In function 'void add(int, int, int)':
parks.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=0;i<bro[{x,y}].size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~
parks.cpp: In function 'void dfs(int)':
parks.cpp:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i=0;i<v[x].size();i++){
      |                 ~^~~~~~~~~~~~
parks.cpp: In function 'void scc(int)':
parks.cpp:47:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(int i=0;i<r[x].size();i++){
      |                 ~^~~~~~~~~~~~
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:102: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]
  102 |     for(int i=0;i<ors.size();i++){
      |                 ~^~~~~~~~~~~
parks.cpp:137:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  137 |                 sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:137:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  137 |                 sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:139:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) + 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  139 |                 sol.push_back({curr,i,x[i]+1,y[i]-1});
parks.cpp:139:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  139 |                 sol.push_back({curr,i,x[i]+1,y[i]-1});
parks.cpp:153:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  153 |                 sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:153:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  153 |                 sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:155:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  155 |                 sol.push_back({curr,i,x[i]-1,y[i]+1});
parks.cpp:155:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) + 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
  155 |                 sol.push_back({curr,i,x[i]-1,y[i]+1});
parks.cpp:162:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bench>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  162 |     for(int i=0;i<sol.size();i++){
      |                 ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 45012 KB Output is correct
2 Correct 26 ms 45020 KB Output is correct
3 Correct 19 ms 37828 KB Output is correct
4 Correct 29 ms 45012 KB Output is correct
5 Correct 28 ms 45080 KB Output is correct
6 Correct 18 ms 37848 KB Output is correct
7 Correct 18 ms 37844 KB Output is correct
8 Correct 17 ms 37844 KB Output is correct
9 Correct 295 ms 99204 KB Output is correct
10 Correct 43 ms 49976 KB Output is correct
11 Correct 107 ms 72780 KB Output is correct
12 Correct 46 ms 52580 KB Output is correct
13 Correct 56 ms 54364 KB Output is correct
14 Correct 17 ms 38152 KB Output is correct
15 Correct 18 ms 38484 KB Output is correct
16 Correct 317 ms 99192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 45012 KB Output is correct
2 Correct 26 ms 45020 KB Output is correct
3 Correct 19 ms 37828 KB Output is correct
4 Correct 29 ms 45012 KB Output is correct
5 Correct 28 ms 45080 KB Output is correct
6 Correct 18 ms 37848 KB Output is correct
7 Correct 18 ms 37844 KB Output is correct
8 Correct 17 ms 37844 KB Output is correct
9 Correct 295 ms 99204 KB Output is correct
10 Correct 43 ms 49976 KB Output is correct
11 Correct 107 ms 72780 KB Output is correct
12 Correct 46 ms 52580 KB Output is correct
13 Correct 56 ms 54364 KB Output is correct
14 Correct 17 ms 38152 KB Output is correct
15 Correct 18 ms 38484 KB Output is correct
16 Correct 317 ms 99192 KB Output is correct
17 Correct 27 ms 45012 KB Output is correct
18 Correct 27 ms 45088 KB Output is correct
19 Correct 27 ms 45012 KB Output is correct
20 Correct 29 ms 44972 KB Output is correct
21 Correct 17 ms 37844 KB Output is correct
22 Correct 28 ms 45032 KB Output is correct
23 Correct 871 ms 153780 KB Output is correct
24 Correct 28 ms 45056 KB Output is correct
25 Correct 35 ms 45644 KB Output is correct
26 Correct 21 ms 38664 KB Output is correct
27 Correct 22 ms 38936 KB Output is correct
28 Correct 241 ms 87320 KB Output is correct
29 Correct 423 ms 109604 KB Output is correct
30 Correct 650 ms 131764 KB Output is correct
31 Correct 835 ms 153816 KB Output is correct
32 Correct 27 ms 45004 KB Output is correct
33 Correct 33 ms 44988 KB Output is correct
34 Correct 27 ms 45008 KB Output is correct
35 Correct 18 ms 37844 KB Output is correct
36 Correct 17 ms 37880 KB Output is correct
37 Correct 27 ms 45048 KB Output is correct
38 Correct 27 ms 45080 KB Output is correct
39 Correct 27 ms 45020 KB Output is correct
40 Correct 27 ms 45084 KB Output is correct
41 Correct 17 ms 37780 KB Output is correct
42 Correct 31 ms 45036 KB Output is correct
43 Correct 19 ms 38436 KB Output is correct
44 Correct 24 ms 38704 KB Output is correct
45 Correct 360 ms 100244 KB Output is correct
46 Correct 644 ms 125948 KB Output is correct
47 Correct 598 ms 125924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 45012 KB Output is correct
2 Correct 26 ms 45020 KB Output is correct
3 Correct 19 ms 37828 KB Output is correct
4 Correct 29 ms 45012 KB Output is correct
5 Correct 28 ms 45080 KB Output is correct
6 Correct 18 ms 37848 KB Output is correct
7 Correct 18 ms 37844 KB Output is correct
8 Correct 17 ms 37844 KB Output is correct
9 Correct 295 ms 99204 KB Output is correct
10 Correct 43 ms 49976 KB Output is correct
11 Correct 107 ms 72780 KB Output is correct
12 Correct 46 ms 52580 KB Output is correct
13 Correct 56 ms 54364 KB Output is correct
14 Correct 17 ms 38152 KB Output is correct
15 Correct 18 ms 38484 KB Output is correct
16 Correct 317 ms 99192 KB Output is correct
17 Correct 27 ms 45012 KB Output is correct
18 Correct 27 ms 45088 KB Output is correct
19 Correct 27 ms 45012 KB Output is correct
20 Correct 29 ms 44972 KB Output is correct
21 Correct 17 ms 37844 KB Output is correct
22 Correct 28 ms 45032 KB Output is correct
23 Correct 871 ms 153780 KB Output is correct
24 Correct 28 ms 45056 KB Output is correct
25 Correct 35 ms 45644 KB Output is correct
26 Correct 21 ms 38664 KB Output is correct
27 Correct 22 ms 38936 KB Output is correct
28 Correct 241 ms 87320 KB Output is correct
29 Correct 423 ms 109604 KB Output is correct
30 Correct 650 ms 131764 KB Output is correct
31 Correct 835 ms 153816 KB Output is correct
32 Correct 27 ms 45004 KB Output is correct
33 Correct 33 ms 44988 KB Output is correct
34 Correct 27 ms 45008 KB Output is correct
35 Correct 18 ms 37844 KB Output is correct
36 Correct 17 ms 37880 KB Output is correct
37 Correct 27 ms 45048 KB Output is correct
38 Correct 27 ms 45080 KB Output is correct
39 Correct 27 ms 45020 KB Output is correct
40 Correct 27 ms 45084 KB Output is correct
41 Correct 17 ms 37780 KB Output is correct
42 Correct 31 ms 45036 KB Output is correct
43 Correct 19 ms 38436 KB Output is correct
44 Correct 24 ms 38704 KB Output is correct
45 Correct 360 ms 100244 KB Output is correct
46 Correct 644 ms 125948 KB Output is correct
47 Correct 598 ms 125924 KB Output is correct
48 Correct 26 ms 45084 KB Output is correct
49 Correct 29 ms 45028 KB Output is correct
50 Correct 32 ms 45044 KB Output is correct
51 Correct 28 ms 45028 KB Output is correct
52 Correct 28 ms 45016 KB Output is correct
53 Correct 27 ms 45004 KB Output is correct
54 Correct 27 ms 45072 KB Output is correct
55 Correct 864 ms 153424 KB Output is correct
56 Correct 28 ms 45012 KB Output is correct
57 Correct 31 ms 45892 KB Output is correct
58 Correct 40 ms 47952 KB Output is correct
59 Correct 30 ms 40420 KB Output is correct
60 Correct 362 ms 97024 KB Output is correct
61 Correct 539 ms 118212 KB Output is correct
62 Correct 674 ms 134340 KB Output is correct
63 Correct 866 ms 153284 KB Output is correct
64 Correct 18 ms 37844 KB Output is correct
65 Correct 28 ms 45012 KB Output is correct
66 Correct 17 ms 37856 KB Output is correct
67 Correct 674 ms 157136 KB Output is correct
68 Correct 679 ms 157136 KB Output is correct
69 Correct 726 ms 156684 KB Output is correct
70 Correct 21 ms 38996 KB Output is correct
71 Correct 26 ms 40112 KB Output is correct
72 Correct 378 ms 99880 KB Output is correct
73 Correct 620 ms 128220 KB Output is correct
74 Correct 940 ms 158984 KB Output is correct
75 Correct 815 ms 153688 KB Output is correct
76 Correct 693 ms 157144 KB Output is correct
77 Correct 28 ms 39300 KB Output is correct
78 Correct 26 ms 40320 KB Output is correct
79 Correct 342 ms 97920 KB Output is correct
80 Correct 589 ms 127532 KB Output is correct
81 Correct 910 ms 155104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 45012 KB Output is correct
2 Correct 26 ms 45020 KB Output is correct
3 Correct 19 ms 37828 KB Output is correct
4 Correct 29 ms 45012 KB Output is correct
5 Correct 28 ms 45080 KB Output is correct
6 Correct 18 ms 37848 KB Output is correct
7 Correct 18 ms 37844 KB Output is correct
8 Correct 17 ms 37844 KB Output is correct
9 Correct 295 ms 99204 KB Output is correct
10 Correct 43 ms 49976 KB Output is correct
11 Correct 107 ms 72780 KB Output is correct
12 Correct 46 ms 52580 KB Output is correct
13 Correct 56 ms 54364 KB Output is correct
14 Correct 17 ms 38152 KB Output is correct
15 Correct 18 ms 38484 KB Output is correct
16 Correct 317 ms 99192 KB Output is correct
17 Correct 27 ms 45056 KB Output is correct
18 Correct 27 ms 45040 KB Output is correct
19 Correct 17 ms 37792 KB Output is correct
20 Correct 945 ms 175144 KB Output is correct
21 Correct 1004 ms 170620 KB Output is correct
22 Correct 920 ms 163232 KB Output is correct
23 Correct 555 ms 137916 KB Output is correct
24 Correct 170 ms 69768 KB Output is correct
25 Correct 605 ms 108860 KB Output is correct
26 Correct 630 ms 109968 KB Output is correct
27 Correct 825 ms 157556 KB Output is correct
28 Correct 877 ms 157528 KB Output is correct
29 Correct 740 ms 157536 KB Output is correct
30 Correct 722 ms 157452 KB Output is correct
31 Correct 31 ms 45068 KB Output is correct
32 Correct 64 ms 52464 KB Output is correct
33 Correct 65 ms 54436 KB Output is correct
34 Correct 1049 ms 178456 KB Output is correct
35 Correct 32 ms 40648 KB Output is correct
36 Correct 93 ms 50684 KB Output is correct
37 Correct 230 ms 63228 KB Output is correct
38 Correct 346 ms 89060 KB Output is correct
39 Correct 463 ms 106508 KB Output is correct
40 Correct 664 ms 124048 KB Output is correct
41 Correct 895 ms 140412 KB Output is correct
42 Correct 1114 ms 157228 KB Output is correct
43 Correct 31 ms 44972 KB Output is correct
44 Correct 32 ms 45004 KB Output is correct
45 Correct 32 ms 45060 KB Output is correct
46 Correct 19 ms 37796 KB Output is correct
47 Correct 20 ms 37888 KB Output is correct
48 Correct 32 ms 45012 KB Output is correct
49 Correct 33 ms 45012 KB Output is correct
50 Correct 31 ms 45052 KB Output is correct
51 Correct 32 ms 45048 KB Output is correct
52 Correct 20 ms 37892 KB Output is correct
53 Correct 35 ms 45016 KB Output is correct
54 Correct 22 ms 38436 KB Output is correct
55 Correct 24 ms 38792 KB Output is correct
56 Correct 377 ms 100620 KB Output is correct
57 Correct 625 ms 126292 KB Output is correct
58 Correct 618 ms 126320 KB Output is correct
59 Correct 21 ms 37844 KB Output is correct
60 Correct 31 ms 45056 KB Output is correct
61 Correct 20 ms 37888 KB Output is correct
62 Correct 711 ms 157500 KB Output is correct
63 Correct 759 ms 157604 KB Output is correct
64 Correct 757 ms 156988 KB Output is correct
65 Correct 25 ms 38996 KB Output is correct
66 Correct 30 ms 40060 KB Output is correct
67 Correct 378 ms 100380 KB Output is correct
68 Correct 690 ms 128852 KB Output is correct
69 Correct 983 ms 159388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 45012 KB Output is correct
2 Correct 26 ms 45020 KB Output is correct
3 Correct 19 ms 37828 KB Output is correct
4 Correct 29 ms 45012 KB Output is correct
5 Correct 28 ms 45080 KB Output is correct
6 Correct 18 ms 37848 KB Output is correct
7 Correct 18 ms 37844 KB Output is correct
8 Correct 17 ms 37844 KB Output is correct
9 Correct 295 ms 99204 KB Output is correct
10 Correct 43 ms 49976 KB Output is correct
11 Correct 107 ms 72780 KB Output is correct
12 Correct 46 ms 52580 KB Output is correct
13 Correct 56 ms 54364 KB Output is correct
14 Correct 17 ms 38152 KB Output is correct
15 Correct 18 ms 38484 KB Output is correct
16 Correct 317 ms 99192 KB Output is correct
17 Correct 749 ms 158532 KB Output is correct
18 Correct 827 ms 158220 KB Output is correct
19 Correct 1044 ms 175300 KB Output is correct
20 Correct 954 ms 151636 KB Output is correct
21 Correct 822 ms 141384 KB Output is correct
22 Correct 32 ms 45008 KB Output is correct
23 Correct 111 ms 61196 KB Output is correct
24 Correct 48 ms 43308 KB Output is correct
25 Correct 134 ms 56444 KB Output is correct
26 Correct 306 ms 69708 KB Output is correct
27 Correct 401 ms 99116 KB Output is correct
28 Correct 543 ms 113908 KB Output is correct
29 Correct 679 ms 128852 KB Output is correct
30 Correct 839 ms 142128 KB Output is correct
31 Correct 992 ms 156008 KB Output is correct
32 Correct 877 ms 153912 KB Output is correct
33 Correct 709 ms 157444 KB Output is correct
34 Correct 25 ms 39252 KB Output is correct
35 Correct 29 ms 40328 KB Output is correct
36 Correct 344 ms 98412 KB Output is correct
37 Correct 658 ms 127900 KB Output is correct
38 Correct 921 ms 155304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 45012 KB Output is correct
2 Correct 26 ms 45020 KB Output is correct
3 Correct 19 ms 37828 KB Output is correct
4 Correct 29 ms 45012 KB Output is correct
5 Correct 28 ms 45080 KB Output is correct
6 Correct 18 ms 37848 KB Output is correct
7 Correct 18 ms 37844 KB Output is correct
8 Correct 17 ms 37844 KB Output is correct
9 Correct 295 ms 99204 KB Output is correct
10 Correct 43 ms 49976 KB Output is correct
11 Correct 107 ms 72780 KB Output is correct
12 Correct 46 ms 52580 KB Output is correct
13 Correct 56 ms 54364 KB Output is correct
14 Correct 17 ms 38152 KB Output is correct
15 Correct 18 ms 38484 KB Output is correct
16 Correct 317 ms 99192 KB Output is correct
17 Correct 27 ms 45012 KB Output is correct
18 Correct 27 ms 45088 KB Output is correct
19 Correct 27 ms 45012 KB Output is correct
20 Correct 29 ms 44972 KB Output is correct
21 Correct 17 ms 37844 KB Output is correct
22 Correct 28 ms 45032 KB Output is correct
23 Correct 871 ms 153780 KB Output is correct
24 Correct 28 ms 45056 KB Output is correct
25 Correct 35 ms 45644 KB Output is correct
26 Correct 21 ms 38664 KB Output is correct
27 Correct 22 ms 38936 KB Output is correct
28 Correct 241 ms 87320 KB Output is correct
29 Correct 423 ms 109604 KB Output is correct
30 Correct 650 ms 131764 KB Output is correct
31 Correct 835 ms 153816 KB Output is correct
32 Correct 27 ms 45004 KB Output is correct
33 Correct 33 ms 44988 KB Output is correct
34 Correct 27 ms 45008 KB Output is correct
35 Correct 18 ms 37844 KB Output is correct
36 Correct 17 ms 37880 KB Output is correct
37 Correct 27 ms 45048 KB Output is correct
38 Correct 27 ms 45080 KB Output is correct
39 Correct 27 ms 45020 KB Output is correct
40 Correct 27 ms 45084 KB Output is correct
41 Correct 17 ms 37780 KB Output is correct
42 Correct 31 ms 45036 KB Output is correct
43 Correct 19 ms 38436 KB Output is correct
44 Correct 24 ms 38704 KB Output is correct
45 Correct 360 ms 100244 KB Output is correct
46 Correct 644 ms 125948 KB Output is correct
47 Correct 598 ms 125924 KB Output is correct
48 Correct 26 ms 45084 KB Output is correct
49 Correct 29 ms 45028 KB Output is correct
50 Correct 32 ms 45044 KB Output is correct
51 Correct 28 ms 45028 KB Output is correct
52 Correct 28 ms 45016 KB Output is correct
53 Correct 27 ms 45004 KB Output is correct
54 Correct 27 ms 45072 KB Output is correct
55 Correct 864 ms 153424 KB Output is correct
56 Correct 28 ms 45012 KB Output is correct
57 Correct 31 ms 45892 KB Output is correct
58 Correct 40 ms 47952 KB Output is correct
59 Correct 30 ms 40420 KB Output is correct
60 Correct 362 ms 97024 KB Output is correct
61 Correct 539 ms 118212 KB Output is correct
62 Correct 674 ms 134340 KB Output is correct
63 Correct 866 ms 153284 KB Output is correct
64 Correct 18 ms 37844 KB Output is correct
65 Correct 28 ms 45012 KB Output is correct
66 Correct 17 ms 37856 KB Output is correct
67 Correct 674 ms 157136 KB Output is correct
68 Correct 679 ms 157136 KB Output is correct
69 Correct 726 ms 156684 KB Output is correct
70 Correct 21 ms 38996 KB Output is correct
71 Correct 26 ms 40112 KB Output is correct
72 Correct 378 ms 99880 KB Output is correct
73 Correct 620 ms 128220 KB Output is correct
74 Correct 940 ms 158984 KB Output is correct
75 Correct 815 ms 153688 KB Output is correct
76 Correct 693 ms 157144 KB Output is correct
77 Correct 28 ms 39300 KB Output is correct
78 Correct 26 ms 40320 KB Output is correct
79 Correct 342 ms 97920 KB Output is correct
80 Correct 589 ms 127532 KB Output is correct
81 Correct 910 ms 155104 KB Output is correct
82 Correct 27 ms 45056 KB Output is correct
83 Correct 27 ms 45040 KB Output is correct
84 Correct 17 ms 37792 KB Output is correct
85 Correct 945 ms 175144 KB Output is correct
86 Correct 1004 ms 170620 KB Output is correct
87 Correct 920 ms 163232 KB Output is correct
88 Correct 555 ms 137916 KB Output is correct
89 Correct 170 ms 69768 KB Output is correct
90 Correct 605 ms 108860 KB Output is correct
91 Correct 630 ms 109968 KB Output is correct
92 Correct 825 ms 157556 KB Output is correct
93 Correct 877 ms 157528 KB Output is correct
94 Correct 740 ms 157536 KB Output is correct
95 Correct 722 ms 157452 KB Output is correct
96 Correct 31 ms 45068 KB Output is correct
97 Correct 64 ms 52464 KB Output is correct
98 Correct 65 ms 54436 KB Output is correct
99 Correct 1049 ms 178456 KB Output is correct
100 Correct 32 ms 40648 KB Output is correct
101 Correct 93 ms 50684 KB Output is correct
102 Correct 230 ms 63228 KB Output is correct
103 Correct 346 ms 89060 KB Output is correct
104 Correct 463 ms 106508 KB Output is correct
105 Correct 664 ms 124048 KB Output is correct
106 Correct 895 ms 140412 KB Output is correct
107 Correct 1114 ms 157228 KB Output is correct
108 Correct 31 ms 44972 KB Output is correct
109 Correct 32 ms 45004 KB Output is correct
110 Correct 32 ms 45060 KB Output is correct
111 Correct 19 ms 37796 KB Output is correct
112 Correct 20 ms 37888 KB Output is correct
113 Correct 32 ms 45012 KB Output is correct
114 Correct 33 ms 45012 KB Output is correct
115 Correct 31 ms 45052 KB Output is correct
116 Correct 32 ms 45048 KB Output is correct
117 Correct 20 ms 37892 KB Output is correct
118 Correct 35 ms 45016 KB Output is correct
119 Correct 22 ms 38436 KB Output is correct
120 Correct 24 ms 38792 KB Output is correct
121 Correct 377 ms 100620 KB Output is correct
122 Correct 625 ms 126292 KB Output is correct
123 Correct 618 ms 126320 KB Output is correct
124 Correct 21 ms 37844 KB Output is correct
125 Correct 31 ms 45056 KB Output is correct
126 Correct 20 ms 37888 KB Output is correct
127 Correct 711 ms 157500 KB Output is correct
128 Correct 759 ms 157604 KB Output is correct
129 Correct 757 ms 156988 KB Output is correct
130 Correct 25 ms 38996 KB Output is correct
131 Correct 30 ms 40060 KB Output is correct
132 Correct 378 ms 100380 KB Output is correct
133 Correct 690 ms 128852 KB Output is correct
134 Correct 983 ms 159388 KB Output is correct
135 Correct 749 ms 158532 KB Output is correct
136 Correct 827 ms 158220 KB Output is correct
137 Correct 1044 ms 175300 KB Output is correct
138 Correct 954 ms 151636 KB Output is correct
139 Correct 822 ms 141384 KB Output is correct
140 Correct 32 ms 45008 KB Output is correct
141 Correct 111 ms 61196 KB Output is correct
142 Correct 48 ms 43308 KB Output is correct
143 Correct 134 ms 56444 KB Output is correct
144 Correct 306 ms 69708 KB Output is correct
145 Correct 401 ms 99116 KB Output is correct
146 Correct 543 ms 113908 KB Output is correct
147 Correct 679 ms 128852 KB Output is correct
148 Correct 839 ms 142128 KB Output is correct
149 Correct 992 ms 156008 KB Output is correct
150 Correct 877 ms 153912 KB Output is correct
151 Correct 709 ms 157444 KB Output is correct
152 Correct 25 ms 39252 KB Output is correct
153 Correct 29 ms 40328 KB Output is correct
154 Correct 344 ms 98412 KB Output is correct
155 Correct 658 ms 127900 KB Output is correct
156 Correct 921 ms 155304 KB Output is correct
157 Correct 30 ms 45012 KB Output is correct
158 Correct 20 ms 37884 KB Output is correct
159 Correct 33 ms 45088 KB Output is correct
160 Correct 30 ms 45052 KB Output is correct
161 Incorrect 923 ms 137140 KB Solution announced impossible, but it is possible.
162 Halted 0 ms 0 KB -