Submission #788567

# Submission time Handle Problem Language Result Execution time Memory
788567 2023-07-20T11:07:14 Z alexander707070 Fountain Parks (IOI21_parks) C++17
70 / 100
706 ms 185092 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],sz[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;
unordered_map<long long, vector<int> > bro;
 
int op(int x){
    if(x<400000)return x+400000;
    return x-400000;
}
 
void add(long long x,long long y,int z){
    for(int i=0;i<bro[x*300000+y].size();i++){
        ors.push_back({op(bro[x*300000+y][i]),op(z)});
    }
    bro[x*300000+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){
    if(sz[root(x)]<sz[root(y)])swap(x,y);
    sz[root(x)]+=sz[root(y)];
    dsu[root(y)]=root(x);
}
 
vector<long long> x,y;

void dfss(long long x,long long y){
    int ss=mp[x*300000+y]-1; 
    
    curr=mp[(x-2)*300000+y];
    if(curr!=0 and root(ss)!=root(curr-1)){
        curr--; mergev(ss,curr);

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

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

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

        br+=2;
        dfss(x,y-2);
    }

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

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

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

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

        br+=2;
        dfss(x,y+2);
    }
}


void dfss2(long long x,long long y){
    int ss=mp[x*300000+y]-1; 
    
    curr=mp[(x-2)*300000+y];
    if(curr!=0 and root(ss)!=root(curr-1)){
        curr--; mergev(ss,curr);

        if(ans[br]==1){
            sol.push_back({curr,ss,x-1,y-1});
        }else{
            sol.push_back({curr,ss,x-1,y+1});
        }
        
        br+=2;
        dfss2(x-2,y);
    }

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

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

        br+=2;
        dfss2(x,y-2);
    }

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

        if(ans[br]==1){
            sol.push_back({curr,ss,x+1,y-1});
        }else{
            sol.push_back({curr,ss,x+1,y+1});
        }
        
        br+=2;
        dfss2(x+2,y);
    }

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

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

        br+=2;
        dfss2(x,y+2);
    }
}
 
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; sz[i]=1;
        x[i]=X[i]; y[i]=Y[i];
        mp[x[i]*300000+y[i]]=i+1;
    }

    br=0;
    dfss(x[0],y[0]);
 
    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; sz[i]=1;
    }
 
    br=0;
    dfss2(x[0],y[0]);
    
    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({2,2,2,2,4,4,4,4,6,6,6,6,8,8,8,8}, {2,4,6,8,2,4,6,8,2,4,6,8,2,4,6,8});
}
*/

Compilation message

parks.cpp: In function 'void add(long long int, long long 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*300000+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 'void dfss2(long long int, long long int)':
parks.cpp:127:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
  127 |             sol.push_back({curr,ss,x-1,y-1});
      |                                    ~^~
parks.cpp:127:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
  127 |             sol.push_back({curr,ss,x-1,y-1});
      |                                        ~^~
parks.cpp:129:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
  129 |             sol.push_back({curr,ss,x-1,y+1});
      |                                    ~^~
parks.cpp:129:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
  129 |             sol.push_back({curr,ss,x-1,y+1});
      |                                        ~^~
parks.cpp:141:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
  141 |             sol.push_back({curr,ss,x-1,y-1});
      |                                    ~^~
parks.cpp:141:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
  141 |             sol.push_back({curr,ss,x-1,y-1});
      |                                        ~^~
parks.cpp:143:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
  143 |             sol.push_back({curr,ss,x+1,y-1});
      |                                    ~^~
parks.cpp:143:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
  143 |             sol.push_back({curr,ss,x+1,y-1});
      |                                        ~^~
parks.cpp:155:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
  155 |             sol.push_back({curr,ss,x+1,y-1});
      |                                    ~^~
parks.cpp:155:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
  155 |             sol.push_back({curr,ss,x+1,y-1});
      |                                        ~^~
parks.cpp:157:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
  157 |             sol.push_back({curr,ss,x+1,y+1});
      |                                    ~^~
parks.cpp:157:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
  157 |             sol.push_back({curr,ss,x+1,y+1});
      |                                        ~^~
parks.cpp:169:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
  169 |             sol.push_back({curr,ss,x-1,y+1});
      |                                    ~^~
parks.cpp:169:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
  169 |             sol.push_back({curr,ss,x-1,y+1});
      |                                        ~^~
parks.cpp:171:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
  171 |             sol.push_back({curr,ss,x+1,y+1});
      |                                    ~^~
parks.cpp:171:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
  171 |             sol.push_back({curr,ss,x+1,y+1});
      |                                        ~^~
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:194: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]
  194 |     for(int i=0;i<ors.size();i++){
      |                 ~^~~~~~~~~~~
parks.cpp:226:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bench>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  226 |     for(int i=0;i<sol.size();i++){
      |                 ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 28 ms 45040 KB Output is correct
2 Correct 30 ms 45048 KB Output is correct
3 Correct 20 ms 37880 KB Output is correct
4 Correct 30 ms 45024 KB Output is correct
5 Correct 29 ms 45096 KB Output is correct
6 Correct 24 ms 37800 KB Output is correct
7 Correct 19 ms 37820 KB Output is correct
8 Correct 19 ms 37844 KB Output is correct
9 Correct 213 ms 100868 KB Output is correct
10 Correct 40 ms 50088 KB Output is correct
11 Correct 89 ms 72812 KB Output is correct
12 Correct 47 ms 52836 KB Output is correct
13 Correct 45 ms 50248 KB Output is correct
14 Correct 21 ms 38084 KB Output is correct
15 Correct 20 ms 38204 KB Output is correct
16 Correct 224 ms 107476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 45040 KB Output is correct
2 Correct 30 ms 45048 KB Output is correct
3 Correct 20 ms 37880 KB Output is correct
4 Correct 30 ms 45024 KB Output is correct
5 Correct 29 ms 45096 KB Output is correct
6 Correct 24 ms 37800 KB Output is correct
7 Correct 19 ms 37820 KB Output is correct
8 Correct 19 ms 37844 KB Output is correct
9 Correct 213 ms 100868 KB Output is correct
10 Correct 40 ms 50088 KB Output is correct
11 Correct 89 ms 72812 KB Output is correct
12 Correct 47 ms 52836 KB Output is correct
13 Correct 45 ms 50248 KB Output is correct
14 Correct 21 ms 38084 KB Output is correct
15 Correct 20 ms 38204 KB Output is correct
16 Correct 224 ms 107476 KB Output is correct
17 Correct 29 ms 45044 KB Output is correct
18 Correct 34 ms 44976 KB Output is correct
19 Correct 31 ms 45008 KB Output is correct
20 Correct 31 ms 45052 KB Output is correct
21 Correct 21 ms 37780 KB Output is correct
22 Correct 30 ms 44960 KB Output is correct
23 Correct 573 ms 168644 KB Output is correct
24 Correct 30 ms 45012 KB Output is correct
25 Correct 31 ms 45692 KB Output is correct
26 Correct 21 ms 38408 KB Output is correct
27 Correct 20 ms 38356 KB Output is correct
28 Correct 146 ms 92848 KB Output is correct
29 Correct 292 ms 117572 KB Output is correct
30 Correct 375 ms 142488 KB Output is correct
31 Correct 466 ms 167300 KB Output is correct
32 Correct 31 ms 45040 KB Output is correct
33 Correct 30 ms 45052 KB Output is correct
34 Correct 31 ms 44964 KB Output is correct
35 Correct 21 ms 37880 KB Output is correct
36 Correct 20 ms 37840 KB Output is correct
37 Correct 30 ms 45052 KB Output is correct
38 Correct 29 ms 45004 KB Output is correct
39 Correct 30 ms 45048 KB Output is correct
40 Correct 32 ms 45052 KB Output is correct
41 Correct 20 ms 37844 KB Output is correct
42 Correct 30 ms 45052 KB Output is correct
43 Correct 21 ms 38344 KB Output is correct
44 Correct 21 ms 38312 KB Output is correct
45 Correct 231 ms 109424 KB Output is correct
46 Correct 344 ms 141180 KB Output is correct
47 Correct 365 ms 140236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 45040 KB Output is correct
2 Correct 30 ms 45048 KB Output is correct
3 Correct 20 ms 37880 KB Output is correct
4 Correct 30 ms 45024 KB Output is correct
5 Correct 29 ms 45096 KB Output is correct
6 Correct 24 ms 37800 KB Output is correct
7 Correct 19 ms 37820 KB Output is correct
8 Correct 19 ms 37844 KB Output is correct
9 Correct 213 ms 100868 KB Output is correct
10 Correct 40 ms 50088 KB Output is correct
11 Correct 89 ms 72812 KB Output is correct
12 Correct 47 ms 52836 KB Output is correct
13 Correct 45 ms 50248 KB Output is correct
14 Correct 21 ms 38084 KB Output is correct
15 Correct 20 ms 38204 KB Output is correct
16 Correct 224 ms 107476 KB Output is correct
17 Correct 29 ms 45044 KB Output is correct
18 Correct 34 ms 44976 KB Output is correct
19 Correct 31 ms 45008 KB Output is correct
20 Correct 31 ms 45052 KB Output is correct
21 Correct 21 ms 37780 KB Output is correct
22 Correct 30 ms 44960 KB Output is correct
23 Correct 573 ms 168644 KB Output is correct
24 Correct 30 ms 45012 KB Output is correct
25 Correct 31 ms 45692 KB Output is correct
26 Correct 21 ms 38408 KB Output is correct
27 Correct 20 ms 38356 KB Output is correct
28 Correct 146 ms 92848 KB Output is correct
29 Correct 292 ms 117572 KB Output is correct
30 Correct 375 ms 142488 KB Output is correct
31 Correct 466 ms 167300 KB Output is correct
32 Correct 31 ms 45040 KB Output is correct
33 Correct 30 ms 45052 KB Output is correct
34 Correct 31 ms 44964 KB Output is correct
35 Correct 21 ms 37880 KB Output is correct
36 Correct 20 ms 37840 KB Output is correct
37 Correct 30 ms 45052 KB Output is correct
38 Correct 29 ms 45004 KB Output is correct
39 Correct 30 ms 45048 KB Output is correct
40 Correct 32 ms 45052 KB Output is correct
41 Correct 20 ms 37844 KB Output is correct
42 Correct 30 ms 45052 KB Output is correct
43 Correct 21 ms 38344 KB Output is correct
44 Correct 21 ms 38312 KB Output is correct
45 Correct 231 ms 109424 KB Output is correct
46 Correct 344 ms 141180 KB Output is correct
47 Correct 365 ms 140236 KB Output is correct
48 Correct 30 ms 45012 KB Output is correct
49 Correct 30 ms 45048 KB Output is correct
50 Correct 30 ms 45056 KB Output is correct
51 Correct 30 ms 45056 KB Output is correct
52 Correct 30 ms 45052 KB Output is correct
53 Correct 31 ms 45040 KB Output is correct
54 Correct 29 ms 45064 KB Output is correct
55 Correct 519 ms 165028 KB Output is correct
56 Correct 30 ms 45084 KB Output is correct
57 Correct 37 ms 45996 KB Output is correct
58 Correct 38 ms 48476 KB Output is correct
59 Correct 22 ms 39304 KB Output is correct
60 Correct 229 ms 105920 KB Output is correct
61 Correct 292 ms 130184 KB Output is correct
62 Correct 424 ms 145592 KB Output is correct
63 Correct 505 ms 165284 KB Output is correct
64 Correct 19 ms 37844 KB Output is correct
65 Correct 30 ms 45056 KB Output is correct
66 Correct 20 ms 37880 KB Output is correct
67 Correct 465 ms 170892 KB Output is correct
68 Correct 459 ms 162396 KB Output is correct
69 Correct 533 ms 165316 KB Output is correct
70 Correct 22 ms 38740 KB Output is correct
71 Correct 24 ms 39108 KB Output is correct
72 Correct 230 ms 103240 KB Output is correct
73 Correct 345 ms 130396 KB Output is correct
74 Correct 546 ms 165636 KB Output is correct
75 Correct 461 ms 168316 KB Output is correct
76 Correct 466 ms 170912 KB Output is correct
77 Correct 22 ms 38864 KB Output is correct
78 Correct 23 ms 39564 KB Output is correct
79 Correct 217 ms 104884 KB Output is correct
80 Correct 349 ms 137252 KB Output is correct
81 Correct 516 ms 163348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 45040 KB Output is correct
2 Correct 30 ms 45048 KB Output is correct
3 Correct 20 ms 37880 KB Output is correct
4 Correct 30 ms 45024 KB Output is correct
5 Correct 29 ms 45096 KB Output is correct
6 Correct 24 ms 37800 KB Output is correct
7 Correct 19 ms 37820 KB Output is correct
8 Correct 19 ms 37844 KB Output is correct
9 Correct 213 ms 100868 KB Output is correct
10 Correct 40 ms 50088 KB Output is correct
11 Correct 89 ms 72812 KB Output is correct
12 Correct 47 ms 52836 KB Output is correct
13 Correct 45 ms 50248 KB Output is correct
14 Correct 21 ms 38084 KB Output is correct
15 Correct 20 ms 38204 KB Output is correct
16 Correct 224 ms 107476 KB Output is correct
17 Correct 30 ms 45012 KB Output is correct
18 Correct 29 ms 45012 KB Output is correct
19 Correct 19 ms 37844 KB Output is correct
20 Correct 532 ms 180220 KB Output is correct
21 Correct 545 ms 178380 KB Output is correct
22 Correct 483 ms 174872 KB Output is correct
23 Correct 493 ms 155880 KB Output is correct
24 Correct 80 ms 56704 KB Output is correct
25 Correct 76 ms 56564 KB Output is correct
26 Correct 72 ms 56568 KB Output is correct
27 Correct 492 ms 152284 KB Output is correct
28 Correct 406 ms 152216 KB Output is correct
29 Correct 529 ms 152336 KB Output is correct
30 Correct 417 ms 152272 KB Output is correct
31 Correct 35 ms 45012 KB Output is correct
32 Correct 63 ms 53084 KB Output is correct
33 Correct 46 ms 47612 KB Output is correct
34 Correct 469 ms 177308 KB Output is correct
35 Correct 27 ms 39552 KB Output is correct
36 Correct 38 ms 44152 KB Output is correct
37 Correct 54 ms 49012 KB Output is correct
38 Correct 172 ms 88200 KB Output is correct
39 Correct 254 ms 104920 KB Output is correct
40 Correct 320 ms 121896 KB Output is correct
41 Correct 501 ms 139144 KB Output is correct
42 Correct 558 ms 155272 KB Output is correct
43 Correct 28 ms 45012 KB Output is correct
44 Correct 28 ms 45052 KB Output is correct
45 Correct 30 ms 45052 KB Output is correct
46 Correct 19 ms 37836 KB Output is correct
47 Correct 19 ms 37844 KB Output is correct
48 Correct 29 ms 45056 KB Output is correct
49 Correct 30 ms 45012 KB Output is correct
50 Correct 29 ms 45012 KB Output is correct
51 Correct 29 ms 44988 KB Output is correct
52 Correct 19 ms 37820 KB Output is correct
53 Correct 29 ms 45092 KB Output is correct
54 Correct 20 ms 38304 KB Output is correct
55 Correct 20 ms 38220 KB Output is correct
56 Correct 289 ms 109424 KB Output is correct
57 Correct 354 ms 141176 KB Output is correct
58 Correct 349 ms 140168 KB Output is correct
59 Correct 20 ms 37796 KB Output is correct
60 Correct 31 ms 45172 KB Output is correct
61 Correct 19 ms 37800 KB Output is correct
62 Correct 500 ms 170984 KB Output is correct
63 Correct 426 ms 162348 KB Output is correct
64 Correct 510 ms 165244 KB Output is correct
65 Correct 22 ms 38740 KB Output is correct
66 Correct 21 ms 39124 KB Output is correct
67 Correct 210 ms 103288 KB Output is correct
68 Correct 361 ms 130452 KB Output is correct
69 Correct 503 ms 165636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 45040 KB Output is correct
2 Correct 30 ms 45048 KB Output is correct
3 Correct 20 ms 37880 KB Output is correct
4 Correct 30 ms 45024 KB Output is correct
5 Correct 29 ms 45096 KB Output is correct
6 Correct 24 ms 37800 KB Output is correct
7 Correct 19 ms 37820 KB Output is correct
8 Correct 19 ms 37844 KB Output is correct
9 Correct 213 ms 100868 KB Output is correct
10 Correct 40 ms 50088 KB Output is correct
11 Correct 89 ms 72812 KB Output is correct
12 Correct 47 ms 52836 KB Output is correct
13 Correct 45 ms 50248 KB Output is correct
14 Correct 21 ms 38084 KB Output is correct
15 Correct 20 ms 38204 KB Output is correct
16 Correct 224 ms 107476 KB Output is correct
17 Correct 651 ms 182688 KB Output is correct
18 Correct 706 ms 179876 KB Output is correct
19 Correct 610 ms 185092 KB Output is correct
20 Correct 498 ms 167912 KB Output is correct
21 Correct 590 ms 156140 KB Output is correct
22 Correct 30 ms 45012 KB Output is correct
23 Correct 82 ms 61300 KB Output is correct
24 Correct 30 ms 41988 KB Output is correct
25 Correct 44 ms 46756 KB Output is correct
26 Correct 59 ms 51536 KB Output is correct
27 Correct 219 ms 104520 KB Output is correct
28 Correct 311 ms 121328 KB Output is correct
29 Correct 420 ms 138652 KB Output is correct
30 Correct 470 ms 152736 KB Output is correct
31 Correct 598 ms 168404 KB Output is correct
32 Correct 478 ms 168356 KB Output is correct
33 Correct 458 ms 170964 KB Output is correct
34 Correct 22 ms 38868 KB Output is correct
35 Correct 23 ms 39636 KB Output is correct
36 Correct 224 ms 104804 KB Output is correct
37 Correct 338 ms 137356 KB Output is correct
38 Correct 507 ms 163388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 45040 KB Output is correct
2 Correct 30 ms 45048 KB Output is correct
3 Correct 20 ms 37880 KB Output is correct
4 Correct 30 ms 45024 KB Output is correct
5 Correct 29 ms 45096 KB Output is correct
6 Correct 24 ms 37800 KB Output is correct
7 Correct 19 ms 37820 KB Output is correct
8 Correct 19 ms 37844 KB Output is correct
9 Correct 213 ms 100868 KB Output is correct
10 Correct 40 ms 50088 KB Output is correct
11 Correct 89 ms 72812 KB Output is correct
12 Correct 47 ms 52836 KB Output is correct
13 Correct 45 ms 50248 KB Output is correct
14 Correct 21 ms 38084 KB Output is correct
15 Correct 20 ms 38204 KB Output is correct
16 Correct 224 ms 107476 KB Output is correct
17 Correct 29 ms 45044 KB Output is correct
18 Correct 34 ms 44976 KB Output is correct
19 Correct 31 ms 45008 KB Output is correct
20 Correct 31 ms 45052 KB Output is correct
21 Correct 21 ms 37780 KB Output is correct
22 Correct 30 ms 44960 KB Output is correct
23 Correct 573 ms 168644 KB Output is correct
24 Correct 30 ms 45012 KB Output is correct
25 Correct 31 ms 45692 KB Output is correct
26 Correct 21 ms 38408 KB Output is correct
27 Correct 20 ms 38356 KB Output is correct
28 Correct 146 ms 92848 KB Output is correct
29 Correct 292 ms 117572 KB Output is correct
30 Correct 375 ms 142488 KB Output is correct
31 Correct 466 ms 167300 KB Output is correct
32 Correct 31 ms 45040 KB Output is correct
33 Correct 30 ms 45052 KB Output is correct
34 Correct 31 ms 44964 KB Output is correct
35 Correct 21 ms 37880 KB Output is correct
36 Correct 20 ms 37840 KB Output is correct
37 Correct 30 ms 45052 KB Output is correct
38 Correct 29 ms 45004 KB Output is correct
39 Correct 30 ms 45048 KB Output is correct
40 Correct 32 ms 45052 KB Output is correct
41 Correct 20 ms 37844 KB Output is correct
42 Correct 30 ms 45052 KB Output is correct
43 Correct 21 ms 38344 KB Output is correct
44 Correct 21 ms 38312 KB Output is correct
45 Correct 231 ms 109424 KB Output is correct
46 Correct 344 ms 141180 KB Output is correct
47 Correct 365 ms 140236 KB Output is correct
48 Correct 30 ms 45012 KB Output is correct
49 Correct 30 ms 45048 KB Output is correct
50 Correct 30 ms 45056 KB Output is correct
51 Correct 30 ms 45056 KB Output is correct
52 Correct 30 ms 45052 KB Output is correct
53 Correct 31 ms 45040 KB Output is correct
54 Correct 29 ms 45064 KB Output is correct
55 Correct 519 ms 165028 KB Output is correct
56 Correct 30 ms 45084 KB Output is correct
57 Correct 37 ms 45996 KB Output is correct
58 Correct 38 ms 48476 KB Output is correct
59 Correct 22 ms 39304 KB Output is correct
60 Correct 229 ms 105920 KB Output is correct
61 Correct 292 ms 130184 KB Output is correct
62 Correct 424 ms 145592 KB Output is correct
63 Correct 505 ms 165284 KB Output is correct
64 Correct 19 ms 37844 KB Output is correct
65 Correct 30 ms 45056 KB Output is correct
66 Correct 20 ms 37880 KB Output is correct
67 Correct 465 ms 170892 KB Output is correct
68 Correct 459 ms 162396 KB Output is correct
69 Correct 533 ms 165316 KB Output is correct
70 Correct 22 ms 38740 KB Output is correct
71 Correct 24 ms 39108 KB Output is correct
72 Correct 230 ms 103240 KB Output is correct
73 Correct 345 ms 130396 KB Output is correct
74 Correct 546 ms 165636 KB Output is correct
75 Correct 461 ms 168316 KB Output is correct
76 Correct 466 ms 170912 KB Output is correct
77 Correct 22 ms 38864 KB Output is correct
78 Correct 23 ms 39564 KB Output is correct
79 Correct 217 ms 104884 KB Output is correct
80 Correct 349 ms 137252 KB Output is correct
81 Correct 516 ms 163348 KB Output is correct
82 Correct 30 ms 45012 KB Output is correct
83 Correct 29 ms 45012 KB Output is correct
84 Correct 19 ms 37844 KB Output is correct
85 Correct 532 ms 180220 KB Output is correct
86 Correct 545 ms 178380 KB Output is correct
87 Correct 483 ms 174872 KB Output is correct
88 Correct 493 ms 155880 KB Output is correct
89 Correct 80 ms 56704 KB Output is correct
90 Correct 76 ms 56564 KB Output is correct
91 Correct 72 ms 56568 KB Output is correct
92 Correct 492 ms 152284 KB Output is correct
93 Correct 406 ms 152216 KB Output is correct
94 Correct 529 ms 152336 KB Output is correct
95 Correct 417 ms 152272 KB Output is correct
96 Correct 35 ms 45012 KB Output is correct
97 Correct 63 ms 53084 KB Output is correct
98 Correct 46 ms 47612 KB Output is correct
99 Correct 469 ms 177308 KB Output is correct
100 Correct 27 ms 39552 KB Output is correct
101 Correct 38 ms 44152 KB Output is correct
102 Correct 54 ms 49012 KB Output is correct
103 Correct 172 ms 88200 KB Output is correct
104 Correct 254 ms 104920 KB Output is correct
105 Correct 320 ms 121896 KB Output is correct
106 Correct 501 ms 139144 KB Output is correct
107 Correct 558 ms 155272 KB Output is correct
108 Correct 28 ms 45012 KB Output is correct
109 Correct 28 ms 45052 KB Output is correct
110 Correct 30 ms 45052 KB Output is correct
111 Correct 19 ms 37836 KB Output is correct
112 Correct 19 ms 37844 KB Output is correct
113 Correct 29 ms 45056 KB Output is correct
114 Correct 30 ms 45012 KB Output is correct
115 Correct 29 ms 45012 KB Output is correct
116 Correct 29 ms 44988 KB Output is correct
117 Correct 19 ms 37820 KB Output is correct
118 Correct 29 ms 45092 KB Output is correct
119 Correct 20 ms 38304 KB Output is correct
120 Correct 20 ms 38220 KB Output is correct
121 Correct 289 ms 109424 KB Output is correct
122 Correct 354 ms 141176 KB Output is correct
123 Correct 349 ms 140168 KB Output is correct
124 Correct 20 ms 37796 KB Output is correct
125 Correct 31 ms 45172 KB Output is correct
126 Correct 19 ms 37800 KB Output is correct
127 Correct 500 ms 170984 KB Output is correct
128 Correct 426 ms 162348 KB Output is correct
129 Correct 510 ms 165244 KB Output is correct
130 Correct 22 ms 38740 KB Output is correct
131 Correct 21 ms 39124 KB Output is correct
132 Correct 210 ms 103288 KB Output is correct
133 Correct 361 ms 130452 KB Output is correct
134 Correct 503 ms 165636 KB Output is correct
135 Correct 651 ms 182688 KB Output is correct
136 Correct 706 ms 179876 KB Output is correct
137 Correct 610 ms 185092 KB Output is correct
138 Correct 498 ms 167912 KB Output is correct
139 Correct 590 ms 156140 KB Output is correct
140 Correct 30 ms 45012 KB Output is correct
141 Correct 82 ms 61300 KB Output is correct
142 Correct 30 ms 41988 KB Output is correct
143 Correct 44 ms 46756 KB Output is correct
144 Correct 59 ms 51536 KB Output is correct
145 Correct 219 ms 104520 KB Output is correct
146 Correct 311 ms 121328 KB Output is correct
147 Correct 420 ms 138652 KB Output is correct
148 Correct 470 ms 152736 KB Output is correct
149 Correct 598 ms 168404 KB Output is correct
150 Correct 478 ms 168356 KB Output is correct
151 Correct 458 ms 170964 KB Output is correct
152 Correct 22 ms 38868 KB Output is correct
153 Correct 23 ms 39636 KB Output is correct
154 Correct 224 ms 104804 KB Output is correct
155 Correct 338 ms 137356 KB Output is correct
156 Correct 507 ms 163388 KB Output is correct
157 Correct 33 ms 45012 KB Output is correct
158 Correct 18 ms 37888 KB Output is correct
159 Correct 28 ms 45024 KB Output is correct
160 Correct 29 ms 45080 KB Output is correct
161 Correct 546 ms 183080 KB Output is correct
162 Correct 508 ms 182844 KB Output is correct
163 Correct 478 ms 161120 KB Output is correct
164 Correct 503 ms 162152 KB Output is correct
165 Correct 606 ms 176892 KB Output is correct
166 Correct 523 ms 181392 KB Output is correct
167 Incorrect 98 ms 69228 KB Solution announced impossible, but it is possible.
168 Halted 0 ms 0 KB -