Submission #166567

# Submission time Handle Problem Language Result Execution time Memory
166567 2019-12-02T20:09:55 Z NaimSS Carnival (CEOI14_carnival) C++14
100 / 100
28 ms 380 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];
        return;
    }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){
            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) + 2 <<" "<<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;
    
    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;
        tenta(i,i+1,n);
          
       cur++;
    }
    for(int i=1;i<=n;i++){
        if(cor[i]==-1)cor[i]=cur++;
    }
    cout<<0;
    for(int i=1;i<=n;i++)cout<<" "<<cor[i];
    cout<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 18 ms 248 KB Output is correct
2 Correct 21 ms 380 KB Output is correct
3 Correct 9 ms 248 KB Output is correct
4 Correct 12 ms 248 KB Output is correct
5 Correct 11 ms 248 KB Output is correct
6 Correct 7 ms 248 KB Output is correct
7 Correct 20 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 376 KB Output is correct
2 Correct 28 ms 376 KB Output is correct
3 Correct 13 ms 248 KB Output is correct
4 Correct 9 ms 248 KB Output is correct
5 Correct 11 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 14 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 17 ms 376 KB Output is correct
3 Correct 24 ms 248 KB Output is correct
4 Correct 10 ms 248 KB Output is correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 8 ms 248 KB Output is correct
7 Correct 12 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 248 KB Output is correct
2 Correct 18 ms 248 KB Output is correct
3 Correct 15 ms 376 KB Output is correct
4 Correct 10 ms 248 KB Output is correct
5 Correct 14 ms 248 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 24 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 22 ms 248 KB Output is correct
3 Correct 19 ms 376 KB Output is correct
4 Correct 19 ms 376 KB Output is correct
5 Correct 14 ms 376 KB Output is correct
6 Correct 15 ms 376 KB Output is correct
7 Correct 7 ms 248 KB Output is correct