답안 #166551

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166551 2019-12-02T19:18:09 Z NaimSS 사육제 (CEOI14_carnival) C++14
20 / 100
121 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

int pai[155];
int cor[155];
int find(int x){
    return (x==pai[x] ? x : pai[x]= find(pai[x]));
}
void join(int a,int b){
    a = find(a);
    b = find(b);
    pai[a] = b;
} 

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    cout<<n;
    for(int i=1;i<=n;i++)cout<<" "<<i;
    for(int i=1;i<=n;i++)pai[i] = i;
    cout<<endl;
    int C;
    cin>>C;
    int comp = n;
    for(int i=1;i<=n;i++)cor[i] = -1;
    int cur=1;
   for(int i=1;i<=n;i++){
        
       if(cor[i]!=-1)continue;
        cor[i] = cur;
       for(int j=i+1;j<=n;j++){
        if(comp==C)break;
          cout<<2<<" "<<i<<" "<<j<<endl;
            int s;
            cin>>s;
            if(s==1){
                cor[j] = cur;
                join(i,j);
                comp--;
            }
        }   
       cur++;
    }
    for(int i=1;i<=n;i++){
        if(cor[i]==-1){
            cor[i]=cur;
            cur++;
        }
    }
    cout<<0;
    for(int i=1;i<=n;i++)cout<<" "<<cor[i];
    cout<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 248 KB Output is correct
2 Partially correct 34 ms 248 KB Partially correct
3 Partially correct 67 ms 376 KB Partially correct
4 Partially correct 77 ms 376 KB Partially correct
5 Correct 5 ms 252 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 24 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 31 ms 376 KB Output is correct
3 Partially correct 51 ms 376 KB Partially correct
4 Partially correct 79 ms 248 KB Partially correct
5 Correct 3 ms 248 KB Output is correct
6 Correct 3 ms 248 KB Output is correct
7 Correct 14 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 12 ms 248 KB Output is correct
3 Partially correct 54 ms 376 KB Partially correct
4 Partially correct 90 ms 376 KB Partially correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Partially correct 42 ms 248 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 11 ms 376 KB Output is correct
3 Partially correct 95 ms 248 KB Partially correct
4 Partially correct 121 ms 280 KB Partially correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 5 ms 248 KB Output is correct
7 Correct 36 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 376 KB Output is correct
2 Correct 25 ms 296 KB Output is correct
3 Partially correct 90 ms 248 KB Partially correct
4 Partially correct 79 ms 248 KB Partially correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Partially correct 94 ms 376 KB Partially correct