답안 #166565

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

int pai[155];
int cor[155];

void tenta(int i,int l,int r){
    if(l==r){
        if(l==i)return;
        cout<<2<<" "<<i<<" "<<l<<endl;
        int x;
        cin>>x;
        if(x==1)cor[l] = cor[i];
    }else{
        
        int m = (l+r)/2;
        if(l!=m){
        cout<<m-l+1;
        for(int i=l;i<=m;i++)cout<<" "<<i;
        cout<<endl;
        int x;
        cin>>x;
        cout<<m-l+2<<" "<<i;
        for(int i=l;i<=m;i++)cout<<" "<<i;
        cout<<endl;
        int y;
        cin>>y;
        if(x==y){
           // cout<<l<<" "<<r<<"-> "<<l<<" "<<m<<endl;
            tenta(i,l,m);
        }
        }else tenta(i,l,l);
        if(r!=m+1){
         cout<<r-(m+1) + 1;
        for(int i=m+1;i<=r;i++)cout<<" "<<i;
        cout<<endl;
        int x;
        cin>>x;
        cout<<r-(m+1) + 1 <<" "<<i;
        for(int i=m+1;i<=r;i++)cout<<" "<<i;
        cout<<endl;
        int y;
        cin>>y;
        if(x==y){
            
           // cout<<l<<" "<<r<<"-> "<<m+1<<" "<<r<<endl;
            tenta(i,m+1,r);
            
        }
        
        }else tenta(i,r,r);
        
    }
    
}

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;
    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;
        //cout<<i<<" "<<i+1<<" "<<n<<endl;
        tenta(i,i+1,n);
          
       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 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -