Submission #304009

# Submission time Handle Problem Language Result Execution time Memory
304009 2020-09-21T00:03:32 Z fadi57 Carnival (CEOI14_carnival) C++14
0 / 100
5 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mx=160;

int cnt=0;
int par[mx];
int n;
int costume[mx];
int query(int x,int y){
    cout<<x+1<<" ";
   for(int i=0;i<x;i++){
       cout<<par[i]+1<<" ";
   }int an;
    cout<<y+1;
    cout<<endl;cin>>an;
    return an;
}

int main() {
cin>>n;

if(n==1){
    cout<<0<<" 1";
    cout<<endl;
}else if(n==2){
    cout<<2<<" 1 2"<<endl;
    int x;cin>>x;
    if(x==1){
        cout<<"0 1 1";
    }else{
        cout<<"0 1 2";
    }cout<<endl;
    
}else{
    
      cnt=1;
        for(int i=1;i<n;i++){
            
            
            if(query(cnt,i)==(cnt+1)){
                costume[i]=cnt;
                 par[cnt]=i;
                cnt++;
               
                
            }else{
                
                
                
                int s=0;int end=cnt-1;ll where;
                while(s<end){
                    int mid=(s+end)/2;
                 if(query(mid,i)==(mid)+1){
                     end=mid-1;where =mid;
                 }else{
                     s=mid+1;
                 }
                    
                    
                    
                }
                costume[i]=where;
            }
        }
    }
    
    
cout<<0<<" ";
for(int i=0;i<n;i++){
    cout<<costume[i]+1<<" ";
}cout<<endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:63:27: warning: 'where' may be used uninitialized in this function [-Wmaybe-uninitialized]
   63 |                 costume[i]=where;
      |                 ~~~~~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer 4859345 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -