답안 #43395

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
43395 2018-03-15T19:41:35 Z Hassoony 사육제 (CEOI14_carnival) C++14
20 / 100
28 ms 4368 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int MX=3e5+9;
int n,p[MX],vis[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++){
            if(find(i)==find(j))continue;
            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:24:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             int x; scanf("%d",&x);
                                  ^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 17 ms 4368 KB Partially correct
2 Partially correct 25 ms 4368 KB Partially correct
3 Partially correct 7 ms 4368 KB Partially correct
4 Partially correct 13 ms 4368 KB Partially correct
5 Partially correct 8 ms 4368 KB Partially correct
6 Correct 0 ms 4368 KB Output is correct
7 Partially correct 8 ms 4368 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 4368 KB Partially correct
2 Partially correct 17 ms 4368 KB Partially correct
3 Partially correct 20 ms 4368 KB Partially correct
4 Partially correct 26 ms 4368 KB Partially correct
5 Partially correct 4 ms 4368 KB Partially correct
6 Correct 0 ms 4368 KB Output is correct
7 Partially correct 26 ms 4368 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4368 KB Output is correct
2 Partially correct 8 ms 4368 KB Partially correct
3 Partially correct 10 ms 4368 KB Partially correct
4 Partially correct 22 ms 4368 KB Partially correct
5 Partially correct 19 ms 4368 KB Partially correct
6 Partially correct 5 ms 4368 KB Partially correct
7 Partially correct 20 ms 4368 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 11 ms 4368 KB Partially correct
2 Partially correct 19 ms 4368 KB Partially correct
3 Partially correct 8 ms 4368 KB Partially correct
4 Partially correct 28 ms 4368 KB Partially correct
5 Partially correct 13 ms 4368 KB Partially correct
6 Partially correct 13 ms 4368 KB Partially correct
7 Partially correct 20 ms 4368 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 3 ms 4368 KB Partially correct
2 Partially correct 16 ms 4368 KB Partially correct
3 Partially correct 27 ms 4368 KB Partially correct
4 Partially correct 20 ms 4368 KB Partially correct
5 Partially correct 15 ms 4368 KB Partially correct
6 Partially correct 4 ms 4368 KB Partially correct
7 Partially correct 15 ms 4368 KB Partially correct