답안 #788571

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
788571 2023-07-20T11:13:20 Z alexander707070 분수 공원 (IOI21_parks) C++17
70 / 100
640 ms 178740 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*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*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+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);
    }
}


void dfss2(long long x,long long y){
    int ss=mp[x*300000+y]-1; 
    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*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+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);
    }
}
 
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;
    int start=rand()%n;
    dfss(x[start],y[start]);
 
    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[start],y[start]);
    
    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:125:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
  125 |             sol.push_back({curr,ss,x-1,y-1});
      |                                    ~^~
parks.cpp:125:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
  125 |             sol.push_back({curr,ss,x-1,y-1});
      |                                        ~^~
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:139:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
  139 |             sol.push_back({curr,ss,x-1,y+1});
      |                                    ~^~
parks.cpp:139:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
  139 |             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:153:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
  153 |             sol.push_back({curr,ss,x-1,y-1});
      |                                    ~^~
parks.cpp:153:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
  153 |             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:167:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
  167 |             sol.push_back({curr,ss,x+1,y-1});
      |                                    ~^~
parks.cpp:167:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
  167 |             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: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:193: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]
  193 |     for(int i=0;i<ors.size();i++){
      |                 ~^~~~~~~~~~~
parks.cpp:225:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bench>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  225 |     for(int i=0;i<sol.size();i++){
      |                 ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 45012 KB Output is correct
2 Correct 26 ms 45012 KB Output is correct
3 Correct 17 ms 37864 KB Output is correct
4 Correct 28 ms 45036 KB Output is correct
5 Correct 27 ms 44996 KB Output is correct
6 Correct 19 ms 37852 KB Output is correct
7 Correct 18 ms 37788 KB Output is correct
8 Correct 18 ms 37868 KB Output is correct
9 Correct 181 ms 105900 KB Output is correct
10 Correct 37 ms 51184 KB Output is correct
11 Correct 83 ms 76868 KB Output is correct
12 Correct 43 ms 53944 KB Output is correct
13 Correct 33 ms 46100 KB Output is correct
14 Correct 18 ms 38100 KB Output is correct
15 Correct 18 ms 38196 KB Output is correct
16 Correct 183 ms 106000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 45012 KB Output is correct
2 Correct 26 ms 45012 KB Output is correct
3 Correct 17 ms 37864 KB Output is correct
4 Correct 28 ms 45036 KB Output is correct
5 Correct 27 ms 44996 KB Output is correct
6 Correct 19 ms 37852 KB Output is correct
7 Correct 18 ms 37788 KB Output is correct
8 Correct 18 ms 37868 KB Output is correct
9 Correct 181 ms 105900 KB Output is correct
10 Correct 37 ms 51184 KB Output is correct
11 Correct 83 ms 76868 KB Output is correct
12 Correct 43 ms 53944 KB Output is correct
13 Correct 33 ms 46100 KB Output is correct
14 Correct 18 ms 38100 KB Output is correct
15 Correct 18 ms 38196 KB Output is correct
16 Correct 183 ms 106000 KB Output is correct
17 Correct 28 ms 45012 KB Output is correct
18 Correct 27 ms 45004 KB Output is correct
19 Correct 28 ms 45008 KB Output is correct
20 Correct 33 ms 45084 KB Output is correct
21 Correct 19 ms 37840 KB Output is correct
22 Correct 28 ms 45000 KB Output is correct
23 Correct 450 ms 178204 KB Output is correct
24 Correct 31 ms 45012 KB Output is correct
25 Correct 34 ms 45764 KB Output is correct
26 Correct 19 ms 38548 KB Output is correct
27 Correct 19 ms 38356 KB Output is correct
28 Correct 141 ms 95992 KB Output is correct
29 Correct 220 ms 123532 KB Output is correct
30 Correct 308 ms 149704 KB Output is correct
31 Correct 451 ms 178184 KB Output is correct
32 Correct 27 ms 45012 KB Output is correct
33 Correct 28 ms 45004 KB Output is correct
34 Correct 28 ms 45004 KB Output is correct
35 Correct 19 ms 37884 KB Output is correct
36 Correct 22 ms 37836 KB Output is correct
37 Correct 28 ms 45004 KB Output is correct
38 Correct 28 ms 45008 KB Output is correct
39 Correct 27 ms 45060 KB Output is correct
40 Correct 29 ms 45064 KB Output is correct
41 Correct 19 ms 37780 KB Output is correct
42 Correct 28 ms 45032 KB Output is correct
43 Correct 19 ms 38228 KB Output is correct
44 Correct 19 ms 38228 KB Output is correct
45 Correct 220 ms 104584 KB Output is correct
46 Correct 405 ms 133204 KB Output is correct
47 Correct 369 ms 137132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 45012 KB Output is correct
2 Correct 26 ms 45012 KB Output is correct
3 Correct 17 ms 37864 KB Output is correct
4 Correct 28 ms 45036 KB Output is correct
5 Correct 27 ms 44996 KB Output is correct
6 Correct 19 ms 37852 KB Output is correct
7 Correct 18 ms 37788 KB Output is correct
8 Correct 18 ms 37868 KB Output is correct
9 Correct 181 ms 105900 KB Output is correct
10 Correct 37 ms 51184 KB Output is correct
11 Correct 83 ms 76868 KB Output is correct
12 Correct 43 ms 53944 KB Output is correct
13 Correct 33 ms 46100 KB Output is correct
14 Correct 18 ms 38100 KB Output is correct
15 Correct 18 ms 38196 KB Output is correct
16 Correct 183 ms 106000 KB Output is correct
17 Correct 28 ms 45012 KB Output is correct
18 Correct 27 ms 45004 KB Output is correct
19 Correct 28 ms 45008 KB Output is correct
20 Correct 33 ms 45084 KB Output is correct
21 Correct 19 ms 37840 KB Output is correct
22 Correct 28 ms 45000 KB Output is correct
23 Correct 450 ms 178204 KB Output is correct
24 Correct 31 ms 45012 KB Output is correct
25 Correct 34 ms 45764 KB Output is correct
26 Correct 19 ms 38548 KB Output is correct
27 Correct 19 ms 38356 KB Output is correct
28 Correct 141 ms 95992 KB Output is correct
29 Correct 220 ms 123532 KB Output is correct
30 Correct 308 ms 149704 KB Output is correct
31 Correct 451 ms 178184 KB Output is correct
32 Correct 27 ms 45012 KB Output is correct
33 Correct 28 ms 45004 KB Output is correct
34 Correct 28 ms 45004 KB Output is correct
35 Correct 19 ms 37884 KB Output is correct
36 Correct 22 ms 37836 KB Output is correct
37 Correct 28 ms 45004 KB Output is correct
38 Correct 28 ms 45008 KB Output is correct
39 Correct 27 ms 45060 KB Output is correct
40 Correct 29 ms 45064 KB Output is correct
41 Correct 19 ms 37780 KB Output is correct
42 Correct 28 ms 45032 KB Output is correct
43 Correct 19 ms 38228 KB Output is correct
44 Correct 19 ms 38228 KB Output is correct
45 Correct 220 ms 104584 KB Output is correct
46 Correct 405 ms 133204 KB Output is correct
47 Correct 369 ms 137132 KB Output is correct
48 Correct 27 ms 45064 KB Output is correct
49 Correct 27 ms 45056 KB Output is correct
50 Correct 27 ms 45012 KB Output is correct
51 Correct 29 ms 45060 KB Output is correct
52 Correct 34 ms 45056 KB Output is correct
53 Correct 29 ms 45084 KB Output is correct
54 Correct 28 ms 45012 KB Output is correct
55 Correct 391 ms 171436 KB Output is correct
56 Correct 29 ms 44972 KB Output is correct
57 Correct 31 ms 46024 KB Output is correct
58 Correct 35 ms 48568 KB Output is correct
59 Correct 22 ms 39252 KB Output is correct
60 Correct 198 ms 107220 KB Output is correct
61 Correct 271 ms 133448 KB Output is correct
62 Correct 334 ms 150928 KB Output is correct
63 Correct 430 ms 172080 KB Output is correct
64 Correct 18 ms 37788 KB Output is correct
65 Correct 30 ms 45068 KB Output is correct
66 Correct 18 ms 37844 KB Output is correct
67 Correct 368 ms 170500 KB Output is correct
68 Correct 426 ms 168116 KB Output is correct
69 Correct 367 ms 171720 KB Output is correct
70 Correct 19 ms 38664 KB Output is correct
71 Correct 20 ms 39124 KB Output is correct
72 Correct 212 ms 102932 KB Output is correct
73 Correct 349 ms 133976 KB Output is correct
74 Correct 501 ms 164184 KB Output is correct
75 Correct 428 ms 172092 KB Output is correct
76 Correct 382 ms 178728 KB Output is correct
77 Correct 20 ms 38812 KB Output is correct
78 Correct 21 ms 39116 KB Output is correct
79 Correct 195 ms 102140 KB Output is correct
80 Correct 346 ms 134452 KB Output is correct
81 Correct 501 ms 162500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 45012 KB Output is correct
2 Correct 26 ms 45012 KB Output is correct
3 Correct 17 ms 37864 KB Output is correct
4 Correct 28 ms 45036 KB Output is correct
5 Correct 27 ms 44996 KB Output is correct
6 Correct 19 ms 37852 KB Output is correct
7 Correct 18 ms 37788 KB Output is correct
8 Correct 18 ms 37868 KB Output is correct
9 Correct 181 ms 105900 KB Output is correct
10 Correct 37 ms 51184 KB Output is correct
11 Correct 83 ms 76868 KB Output is correct
12 Correct 43 ms 53944 KB Output is correct
13 Correct 33 ms 46100 KB Output is correct
14 Correct 18 ms 38100 KB Output is correct
15 Correct 18 ms 38196 KB Output is correct
16 Correct 183 ms 106000 KB Output is correct
17 Correct 28 ms 45012 KB Output is correct
18 Correct 28 ms 45024 KB Output is correct
19 Correct 18 ms 37892 KB Output is correct
20 Correct 529 ms 177940 KB Output is correct
21 Correct 477 ms 172184 KB Output is correct
22 Correct 501 ms 175364 KB Output is correct
23 Correct 483 ms 150032 KB Output is correct
24 Correct 70 ms 54928 KB Output is correct
25 Correct 76 ms 54920 KB Output is correct
26 Correct 78 ms 54980 KB Output is correct
27 Correct 410 ms 150644 KB Output is correct
28 Correct 447 ms 150588 KB Output is correct
29 Correct 573 ms 150624 KB Output is correct
30 Correct 566 ms 150604 KB Output is correct
31 Correct 28 ms 45072 KB Output is correct
32 Correct 52 ms 52592 KB Output is correct
33 Correct 43 ms 46348 KB Output is correct
34 Correct 526 ms 177712 KB Output is correct
35 Correct 24 ms 39508 KB Output is correct
36 Correct 36 ms 43496 KB Output is correct
37 Correct 51 ms 47684 KB Output is correct
38 Correct 206 ms 87140 KB Output is correct
39 Correct 246 ms 103600 KB Output is correct
40 Correct 323 ms 120088 KB Output is correct
41 Correct 436 ms 136880 KB Output is correct
42 Correct 583 ms 152692 KB Output is correct
43 Correct 28 ms 45012 KB Output is correct
44 Correct 28 ms 45008 KB Output is correct
45 Correct 28 ms 45000 KB Output is correct
46 Correct 19 ms 37860 KB Output is correct
47 Correct 18 ms 37880 KB Output is correct
48 Correct 29 ms 44988 KB Output is correct
49 Correct 28 ms 45080 KB Output is correct
50 Correct 29 ms 44984 KB Output is correct
51 Correct 33 ms 45004 KB Output is correct
52 Correct 19 ms 37844 KB Output is correct
53 Correct 28 ms 45032 KB Output is correct
54 Correct 20 ms 38228 KB Output is correct
55 Correct 19 ms 38248 KB Output is correct
56 Correct 205 ms 104564 KB Output is correct
57 Correct 377 ms 133176 KB Output is correct
58 Correct 366 ms 137220 KB Output is correct
59 Correct 18 ms 37844 KB Output is correct
60 Correct 28 ms 45020 KB Output is correct
61 Correct 21 ms 37844 KB Output is correct
62 Correct 376 ms 170532 KB Output is correct
63 Correct 376 ms 168156 KB Output is correct
64 Correct 408 ms 171752 KB Output is correct
65 Correct 20 ms 38616 KB Output is correct
66 Correct 21 ms 39128 KB Output is correct
67 Correct 221 ms 102940 KB Output is correct
68 Correct 357 ms 133888 KB Output is correct
69 Correct 530 ms 164136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 45012 KB Output is correct
2 Correct 26 ms 45012 KB Output is correct
3 Correct 17 ms 37864 KB Output is correct
4 Correct 28 ms 45036 KB Output is correct
5 Correct 27 ms 44996 KB Output is correct
6 Correct 19 ms 37852 KB Output is correct
7 Correct 18 ms 37788 KB Output is correct
8 Correct 18 ms 37868 KB Output is correct
9 Correct 181 ms 105900 KB Output is correct
10 Correct 37 ms 51184 KB Output is correct
11 Correct 83 ms 76868 KB Output is correct
12 Correct 43 ms 53944 KB Output is correct
13 Correct 33 ms 46100 KB Output is correct
14 Correct 18 ms 38100 KB Output is correct
15 Correct 18 ms 38196 KB Output is correct
16 Correct 183 ms 106000 KB Output is correct
17 Correct 584 ms 175924 KB Output is correct
18 Correct 640 ms 173480 KB Output is correct
19 Correct 602 ms 178088 KB Output is correct
20 Correct 472 ms 160556 KB Output is correct
21 Correct 487 ms 149720 KB Output is correct
22 Correct 29 ms 45012 KB Output is correct
23 Correct 79 ms 60956 KB Output is correct
24 Correct 29 ms 41636 KB Output is correct
25 Correct 44 ms 45488 KB Output is correct
26 Correct 57 ms 49684 KB Output is correct
27 Correct 207 ms 100292 KB Output is correct
28 Correct 274 ms 115432 KB Output is correct
29 Correct 371 ms 131868 KB Output is correct
30 Correct 434 ms 145696 KB Output is correct
31 Correct 534 ms 160036 KB Output is correct
32 Correct 421 ms 172060 KB Output is correct
33 Correct 398 ms 178740 KB Output is correct
34 Correct 18 ms 38848 KB Output is correct
35 Correct 18 ms 39124 KB Output is correct
36 Correct 212 ms 102256 KB Output is correct
37 Correct 343 ms 134344 KB Output is correct
38 Correct 524 ms 162440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 45012 KB Output is correct
2 Correct 26 ms 45012 KB Output is correct
3 Correct 17 ms 37864 KB Output is correct
4 Correct 28 ms 45036 KB Output is correct
5 Correct 27 ms 44996 KB Output is correct
6 Correct 19 ms 37852 KB Output is correct
7 Correct 18 ms 37788 KB Output is correct
8 Correct 18 ms 37868 KB Output is correct
9 Correct 181 ms 105900 KB Output is correct
10 Correct 37 ms 51184 KB Output is correct
11 Correct 83 ms 76868 KB Output is correct
12 Correct 43 ms 53944 KB Output is correct
13 Correct 33 ms 46100 KB Output is correct
14 Correct 18 ms 38100 KB Output is correct
15 Correct 18 ms 38196 KB Output is correct
16 Correct 183 ms 106000 KB Output is correct
17 Correct 28 ms 45012 KB Output is correct
18 Correct 27 ms 45004 KB Output is correct
19 Correct 28 ms 45008 KB Output is correct
20 Correct 33 ms 45084 KB Output is correct
21 Correct 19 ms 37840 KB Output is correct
22 Correct 28 ms 45000 KB Output is correct
23 Correct 450 ms 178204 KB Output is correct
24 Correct 31 ms 45012 KB Output is correct
25 Correct 34 ms 45764 KB Output is correct
26 Correct 19 ms 38548 KB Output is correct
27 Correct 19 ms 38356 KB Output is correct
28 Correct 141 ms 95992 KB Output is correct
29 Correct 220 ms 123532 KB Output is correct
30 Correct 308 ms 149704 KB Output is correct
31 Correct 451 ms 178184 KB Output is correct
32 Correct 27 ms 45012 KB Output is correct
33 Correct 28 ms 45004 KB Output is correct
34 Correct 28 ms 45004 KB Output is correct
35 Correct 19 ms 37884 KB Output is correct
36 Correct 22 ms 37836 KB Output is correct
37 Correct 28 ms 45004 KB Output is correct
38 Correct 28 ms 45008 KB Output is correct
39 Correct 27 ms 45060 KB Output is correct
40 Correct 29 ms 45064 KB Output is correct
41 Correct 19 ms 37780 KB Output is correct
42 Correct 28 ms 45032 KB Output is correct
43 Correct 19 ms 38228 KB Output is correct
44 Correct 19 ms 38228 KB Output is correct
45 Correct 220 ms 104584 KB Output is correct
46 Correct 405 ms 133204 KB Output is correct
47 Correct 369 ms 137132 KB Output is correct
48 Correct 27 ms 45064 KB Output is correct
49 Correct 27 ms 45056 KB Output is correct
50 Correct 27 ms 45012 KB Output is correct
51 Correct 29 ms 45060 KB Output is correct
52 Correct 34 ms 45056 KB Output is correct
53 Correct 29 ms 45084 KB Output is correct
54 Correct 28 ms 45012 KB Output is correct
55 Correct 391 ms 171436 KB Output is correct
56 Correct 29 ms 44972 KB Output is correct
57 Correct 31 ms 46024 KB Output is correct
58 Correct 35 ms 48568 KB Output is correct
59 Correct 22 ms 39252 KB Output is correct
60 Correct 198 ms 107220 KB Output is correct
61 Correct 271 ms 133448 KB Output is correct
62 Correct 334 ms 150928 KB Output is correct
63 Correct 430 ms 172080 KB Output is correct
64 Correct 18 ms 37788 KB Output is correct
65 Correct 30 ms 45068 KB Output is correct
66 Correct 18 ms 37844 KB Output is correct
67 Correct 368 ms 170500 KB Output is correct
68 Correct 426 ms 168116 KB Output is correct
69 Correct 367 ms 171720 KB Output is correct
70 Correct 19 ms 38664 KB Output is correct
71 Correct 20 ms 39124 KB Output is correct
72 Correct 212 ms 102932 KB Output is correct
73 Correct 349 ms 133976 KB Output is correct
74 Correct 501 ms 164184 KB Output is correct
75 Correct 428 ms 172092 KB Output is correct
76 Correct 382 ms 178728 KB Output is correct
77 Correct 20 ms 38812 KB Output is correct
78 Correct 21 ms 39116 KB Output is correct
79 Correct 195 ms 102140 KB Output is correct
80 Correct 346 ms 134452 KB Output is correct
81 Correct 501 ms 162500 KB Output is correct
82 Correct 28 ms 45012 KB Output is correct
83 Correct 28 ms 45024 KB Output is correct
84 Correct 18 ms 37892 KB Output is correct
85 Correct 529 ms 177940 KB Output is correct
86 Correct 477 ms 172184 KB Output is correct
87 Correct 501 ms 175364 KB Output is correct
88 Correct 483 ms 150032 KB Output is correct
89 Correct 70 ms 54928 KB Output is correct
90 Correct 76 ms 54920 KB Output is correct
91 Correct 78 ms 54980 KB Output is correct
92 Correct 410 ms 150644 KB Output is correct
93 Correct 447 ms 150588 KB Output is correct
94 Correct 573 ms 150624 KB Output is correct
95 Correct 566 ms 150604 KB Output is correct
96 Correct 28 ms 45072 KB Output is correct
97 Correct 52 ms 52592 KB Output is correct
98 Correct 43 ms 46348 KB Output is correct
99 Correct 526 ms 177712 KB Output is correct
100 Correct 24 ms 39508 KB Output is correct
101 Correct 36 ms 43496 KB Output is correct
102 Correct 51 ms 47684 KB Output is correct
103 Correct 206 ms 87140 KB Output is correct
104 Correct 246 ms 103600 KB Output is correct
105 Correct 323 ms 120088 KB Output is correct
106 Correct 436 ms 136880 KB Output is correct
107 Correct 583 ms 152692 KB Output is correct
108 Correct 28 ms 45012 KB Output is correct
109 Correct 28 ms 45008 KB Output is correct
110 Correct 28 ms 45000 KB Output is correct
111 Correct 19 ms 37860 KB Output is correct
112 Correct 18 ms 37880 KB Output is correct
113 Correct 29 ms 44988 KB Output is correct
114 Correct 28 ms 45080 KB Output is correct
115 Correct 29 ms 44984 KB Output is correct
116 Correct 33 ms 45004 KB Output is correct
117 Correct 19 ms 37844 KB Output is correct
118 Correct 28 ms 45032 KB Output is correct
119 Correct 20 ms 38228 KB Output is correct
120 Correct 19 ms 38248 KB Output is correct
121 Correct 205 ms 104564 KB Output is correct
122 Correct 377 ms 133176 KB Output is correct
123 Correct 366 ms 137220 KB Output is correct
124 Correct 18 ms 37844 KB Output is correct
125 Correct 28 ms 45020 KB Output is correct
126 Correct 21 ms 37844 KB Output is correct
127 Correct 376 ms 170532 KB Output is correct
128 Correct 376 ms 168156 KB Output is correct
129 Correct 408 ms 171752 KB Output is correct
130 Correct 20 ms 38616 KB Output is correct
131 Correct 21 ms 39128 KB Output is correct
132 Correct 221 ms 102940 KB Output is correct
133 Correct 357 ms 133888 KB Output is correct
134 Correct 530 ms 164136 KB Output is correct
135 Correct 584 ms 175924 KB Output is correct
136 Correct 640 ms 173480 KB Output is correct
137 Correct 602 ms 178088 KB Output is correct
138 Correct 472 ms 160556 KB Output is correct
139 Correct 487 ms 149720 KB Output is correct
140 Correct 29 ms 45012 KB Output is correct
141 Correct 79 ms 60956 KB Output is correct
142 Correct 29 ms 41636 KB Output is correct
143 Correct 44 ms 45488 KB Output is correct
144 Correct 57 ms 49684 KB Output is correct
145 Correct 207 ms 100292 KB Output is correct
146 Correct 274 ms 115432 KB Output is correct
147 Correct 371 ms 131868 KB Output is correct
148 Correct 434 ms 145696 KB Output is correct
149 Correct 534 ms 160036 KB Output is correct
150 Correct 421 ms 172060 KB Output is correct
151 Correct 398 ms 178740 KB Output is correct
152 Correct 18 ms 38848 KB Output is correct
153 Correct 18 ms 39124 KB Output is correct
154 Correct 212 ms 102256 KB Output is correct
155 Correct 343 ms 134344 KB Output is correct
156 Correct 524 ms 162440 KB Output is correct
157 Correct 26 ms 45012 KB Output is correct
158 Correct 17 ms 37844 KB Output is correct
159 Correct 26 ms 44992 KB Output is correct
160 Correct 30 ms 45004 KB Output is correct
161 Correct 584 ms 165820 KB Output is correct
162 Correct 492 ms 175468 KB Output is correct
163 Correct 506 ms 166356 KB Output is correct
164 Correct 482 ms 164620 KB Output is correct
165 Correct 551 ms 169900 KB Output is correct
166 Correct 554 ms 173492 KB Output is correct
167 Incorrect 99 ms 66864 KB Solution announced impossible, but it is possible.
168 Halted 0 ms 0 KB -