Submission #43393

# Submission time Handle Problem Language Result Execution time Memory
43393 2018-03-15T19:37:01 Z Hassoony Carnival (CEOI14_carnival) C++14
20 / 100
39 ms 3196 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]);
}
map<int,int>hashy;
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);
        }
    }
    for(int i=1;i<=n;i++){
        hashy[p[i]]=1;
    }
    int tt=1;
    for(auto pp:hashy){
        hashy[pp.first]=tt++;
    }
    cout<<0<<" ";
    for(int i=1;i<n;i++)cout<<hashy[p[i]]<<" ";
    cout<<hashy[p[n]]<<endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:18:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
carnival.cpp:23: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 Partially correct 22 ms 3196 KB Partially correct
2 Partially correct 19 ms 3196 KB Partially correct
3 Partially correct 12 ms 3196 KB Partially correct
4 Partially correct 39 ms 3196 KB Partially correct
5 Partially correct 14 ms 3196 KB Partially correct
6 Partially correct 27 ms 3196 KB Partially correct
7 Partially correct 22 ms 3196 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 16 ms 3196 KB Partially correct
2 Partially correct 26 ms 3196 KB Partially correct
3 Partially correct 7 ms 3196 KB Partially correct
4 Partially correct 15 ms 3196 KB Partially correct
5 Partially correct 24 ms 3196 KB Partially correct
6 Partially correct 4 ms 3196 KB Partially correct
7 Partially correct 12 ms 3196 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 7 ms 3196 KB Partially correct
2 Partially correct 13 ms 3196 KB Partially correct
3 Partially correct 3 ms 3196 KB Partially correct
4 Partially correct 30 ms 3196 KB Partially correct
5 Partially correct 12 ms 3196 KB Partially correct
6 Partially correct 13 ms 3196 KB Partially correct
7 Partially correct 16 ms 3196 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 12 ms 3196 KB Partially correct
2 Partially correct 17 ms 3196 KB Partially correct
3 Partially correct 16 ms 3196 KB Partially correct
4 Partially correct 4 ms 3196 KB Partially correct
5 Partially correct 4 ms 3196 KB Partially correct
6 Partially correct 4 ms 3196 KB Partially correct
7 Partially correct 8 ms 3196 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 9 ms 3196 KB Partially correct
2 Partially correct 8 ms 3196 KB Partially correct
3 Partially correct 15 ms 3196 KB Partially correct
4 Partially correct 16 ms 3196 KB Partially correct
5 Partially correct 20 ms 3196 KB Partially correct
6 Partially correct 19 ms 3196 KB Partially correct
7 Partially correct 14 ms 3196 KB Partially correct