Submission #908833

# Submission time Handle Problem Language Result Execution time Memory
908833 2024-01-17T00:18:10 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
12 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

long long n, arr[100005], brr[100005], xd, k,zd;

void BB(int a, int b){
    if(a>=b)return;
    //cout<<xd<<"\n";
    int c=(a+b+1)/2, x, y;
    
    if(c-a==1){
        x=1;
    }
    else{
        cout<<c-a<<' ';
        
        for(int i=a; i<c; i++)cout<<i<<' ';
        cout<<endl;
        
        cin>>x;
        }
    
    
    cout<<c-a+1<<' ';
    
    for(int i=a; i<c; i++)cout<<i<<' ';
    cout<<xd<<endl;
    
    cin>>y;
    
    if(c-a==1&&x==y){
        arr[xd]=arr[a];
        return;
    }
    
    if(x==y){
        BB(a,c);
        return;
    }
    
    BB(c,b);
    
}

int main(){
    
    cin>>n;
    
    arr[1]=brr[1]=1;zd=2;
    
    for(int i=2; i<=n; i++){
        cout<<i<<' ';
        for(int j=1; j<=i; j++)cout<<j<<' ';
        cout<<endl;
        
        cin>>k;
        brr[i]=brr[i-1];
        
        if(k==brr[i]+1){
            brr[i]++;
            arr[i]=zd;
            zd++;
            continue;
        }
        xd=i;
        BB(1, i);
        
    }
    
    
    cout<<"0 ";
    for(int j=1; j<=n; j++)cout<<arr[j]<<' ';
    cout<<endl;
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 11 ms 344 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 9 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 9 ms 344 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 12 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct