Submission #919884

#TimeUsernameProblemLanguageResultExecution timeMemory
919884HaciyevAlikCarnival (CEOI14_carnival)C++14
0 / 100
2 ms344 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int ans[155]; int main(){ //ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,x=1; cin >> n; vector<int> v; ans[1]=1; v.push_back(1); for(int i=2;i<=n;++i) { int l=1,r=int(v.size()),best=0; while(l<=r) { int mid=(l+r)/2; cout << mid + 1 << ' ' << i << ' '; for(int j=0;j<mid;++j) { cout << v[j] << ' '; } cout << '\n'; fflush(stdout); int cur; cin >> cur; if(cur==mid+1) { best=mid; l=mid+1; } else { r=mid-1; } } if(best==v.size()) { v.push_back(++x); ans[i]=x; } else { ans[i]=v[best]; } } cout << "0 "; for(int i=1;i<=n;++i) { cout << ans[i] << ' '; } return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(best==v.size()) {
      |            ~~~~^~~~~~~~~~
#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...