Submission #113239

# Submission time Handle Problem Language Result Execution time Memory
113239 2019-05-24T11:50:42 Z brcode Carnival (CEOI14_carnival) C++14
0 / 100
3 ms 384 KB
#include <iostream>

using namespace std;
const int MAXN = 155;
int counter = 1;
int arr[MAXN];
int maxsz;
int n;
void rec(int l,int r){
    //cout<<l<<" "<<r<<endl;
    if(l == r){
        arr[l] = counter;
        counter++;
        
        return;
    }
    cout<<(r-l+1)<<" ";
    for(int i=l;i<=r;i++){
        cout<<i<<" ";
    }
    cout << endl;
    cout<<endl;
    cout.flush();
    int sz;
    cin>>sz;
    if(l == 1 && r == n){
        maxsz = sz;
    }
    if(sz == (r-l+1)){
        
        for(int i=l;i<=r;i++){
            arr[i] = counter;
            counter++;
            
        }
        return;
    }
    if(sz == 1){
        for(int i=l;i<=r;i++){
            arr[i] = counter;
            
        }
        counter++;
       
        return;
    }
    int mid = (l+r)/2;
    rec(l,mid);
    rec(mid+1,r);
}
int main(){
  
    cin>>n;

    rec(1,n);
    cout<<0<<" ";
    for(int i=1;i<=n;i++){
        cout<<arr[i]<<" ";
    }
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer 12 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Integer 9 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 128 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Integer 3 violates the range [1, 2]
2 Halted 0 ms 0 KB -