Submission #43392

# Submission time Handle Problem Language Result Execution time Memory
43392 2018-03-15T19:35:43 Z Hassoony Carnival (CEOI14_carnival) C++14
0 / 100
22 ms 3192 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int MX=3e5+9;
int n,p[MX];
int find(int x){
    if(x==p[x])return x;
    return p[x]=find(p[x]);
}
void merge_(int x,int y){
    x=find(x);
    y=find(y);
    p[y]=x;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)p[i]=i;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            cout<<2<<" "<<i<<" "<<j<<endl;
            int x; scanf("%d",&x);
            if(x==1)merge_(i,j);
        }
    }
    cout<<0<<" ";
    for(int i=1;i<=n;i++)cout<<p[i]<<" ";
    cout<<endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:17:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
carnival.cpp:22:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             int x; scanf("%d",&x);
                                  ^
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 3192 KB Integer 19 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 3192 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 14 ms 3192 KB Partially correct
2 Incorrect 15 ms 3192 KB Integer 11 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 3192 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 7 ms 3192 KB Partially correct
2 Incorrect 15 ms 3192 KB Integer 20 violates the range [1, 17]
3 Halted 0 ms 0 KB -