Submission #978172

#TimeUsernameProblemLanguageResultExecution timeMemory
978172AlphaMale06Carnival (CEOI14_carnival)C++17
100 / 100
4 ms600 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 sz = qry.size(); bool mark[sz]; for(int j=0; j< sz; j++)mark[j]=0; int cnt=sz; while(cnt>1){ int mk = cnt>>1; vector<int> qry1; vector<int> kolkogej; for(int j=0; j<sz; j++){ if(!mark[j]){ mk--; qry1.pb(qry[j]); kolkogej.pb(j); } if(mk==0)break; } cout << qry1.size()+1; for(int e : qry1)cout << " " << e; cout << " " << i << endl; int ans1; cin >> ans1; if(ans1==qry1.size()+1){ for(int e : kolkogej){ mark[e]=1; } } else{ for(int j=0; j<sz; j++)mark[j]=1; for(int e : kolkogej){ mark[e]=0; } } cnt=0; for(int j=0; j< sz; j++){ if(!mark[j])cnt++; } } for(int j=0; j < sz; j++){ if(!mark[j]){ c[i]=c[qry[j]]; break; } } } } 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:48:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |                 if(ans1==qry1.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...