Submission #1085717

#TimeUsernameProblemLanguageResultExecution timeMemory
1085717vjudge1Carnival (CEOI14_carnival)C++17
0 / 100
82 ms592 KiB
#include <bits/stdc++.h> using namespace std; vector<int>v; bool check2(int l,int r,int k) { cout<<r-l+2<<" "; for(int i=l;i<=r;i++) { cout<<v[i]<<" "; } cout<<k<<endl; int a; cin>>a; if(a==r-l+2) { return true; } return false; } bool check(int k) { cout<<v.size()+1<<" "; for(int i=0;i<v.size();i++) { cout<<v[i]<<" "; } cout<<k<<endl; int a; cin>>a; if(a==v.size()+1) { return true; } return false; } int main() { int n,cnt=1; cin>>n; vector<int>res(n+1); res[1]=cnt++; v.push_back(1); for(int i=2;i<=n;i++) { if(check(i)) { v.push_back(i); res[i]=cnt++; } else { int l=0,r=v.size()-1; while(l<r) { int m=l+r/2; if(check2(l,m,i)) { l=m+1; } else { r=m; } } res[i]=res[v[l]]; } } cout<<"0 "; for(int i=1;i<=n;i++) { cout<<res[i]<<" "; } cout<<endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'bool check(int)':
carnival.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
carnival.cpp:30:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     if(a==v.size()+1)
      |        ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...