Submission #475531

# Submission time Handle Problem Language Result Execution time Memory
475531 2021-09-22T18:30:47 Z Sarah_Mokhtar Carnival (CEOI14_carnival) C++14
0 / 100
13 ms 200 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define read freopen("acpc.in","r",stdin);
#define LESSGO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll N=150,M=505,OO=1e16,mod=1e9+9;
int n,ans[N];
vector<int>cols;
int ask(int l,int r,int i){
    cout<<r-l+1+(i!=-1)<<endl;
    for(int i=l;i<=r;++i) cout<<cols[i]<<' ';
    if(~i) cout<<i<<' ';
    cout<<endl;
    int output; cin>>output;
    return output;
}
int rangeAsk(int l,int r){
    cout<<r-l+1<<endl;
    for(int i=l;i<=r;++i) cout<<i<<' ';
    cout<<endl;
    int output; cin>>output;
    return output;
}
int solve(int l,int r,int i){
    if(l==r){
        return l;
    }
    int mid=(l+r)>>1;
    int a=ask(l,mid,i);
    int b=ask(l,mid,-1);
    if(a==b) return solve(l,mid,i);
    else return solve(mid+1,r,i);
}
int main(){
    cin>>n;
    ans[1]=1;
    cols.push_back(1);
    for(int i=2;i<=n;++i){
        int g=rangeAsk(1,i);
        if(g>cols.size()){
            cols.push_back(i);
            ans[i]=g;
            continue;
        }
        ans[i]=ans[cols[solve(0,cols.size()-1,i)]];
    }
    for(int i=0;i<n;++i){
        cout<<ans[i+1]<<' ';
    }
    cout<<endl;

}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:40:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if(g>cols.size()){
      |            ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 200 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 200 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 200 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 200 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 200 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -