Submission #113234

# Submission time Handle Problem Language Result Execution time Memory
113234 2019-05-24T11:40:47 Z brcode Carnival (CEOI14_carnival) C++14
0 / 100
4 ms 432 KB
#include <iostream>

using namespace std;
const int MAXN = 155;
int counter = 1;
int arr[MAXN];
void rec(int l,int r){
    
    if(l == r){
        arr[l] = counter;
        counter++;
        return;
    }
    cout<<(r-l+1)<<" ";
    for(int i=l;i<=r;i++){
        cout<<i<<" ";
    }
    cout<<endl;
    cout.flush();
    int sz;
    cin>>sz;
    
    if(sz == (r-l+1)){
        
        for(int i=l;i<=r;i++){
            arr[i] = counter;
            counter++;
        }
        return;
    }
    else 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(){
    int n;
    cin>>n;
 
  

    rec(1,n);
    cout<<0<<" ";
    for(int i=1;i<=n;i++){
        cout<<arr[i]<<" ";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Integer 12 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 432 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 3 ms 256 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 -