Submission #978168

#TimeUsernameProblemLanguageResultExecution timeMemory
978168AlphaMale06Carnival (CEOI14_carnival)C++14
0 / 100
4 ms344 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back int main() { int n; cin >> n; vector<int> qry; qry.pb(1); int c[n+1]; c[1]=1; for(int i=2; i<=n; i++){ qry.pb(i); cout << qry.size(); for(int e : qry)cout << " " << e; cout << endl; int ans; cin >> ans; if(ans==qry.size()){ c[i]=qry.size(); } else{ qry.pop_back(); int l=0, r = qry.size()-1; while(l<r){ int s = l+r>>1; cout << s-l+1; for(int i=l; i<s; i++)cout << " " << qry[i]; cout << " " << i << endl; int anss; cin >> anss; if(anss==s-l+1)r=s; else l=s+1; } c[i]=c[qry[l]]; } } cout << 0; for(int i=1; i<=n; i++)cout << " " << c[i]; cout << endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:22:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if(ans==qry.size()){
      |            ~~~^~~~~~~~~~~~
carnival.cpp:29:26: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   29 |                 int s = l+r>>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...