Submission #995994

#TimeUsernameProblemLanguageResultExecution timeMemory
995994vjudge1Carnival (CEOI14_carnival)C++14
0 / 100
5 ms596 KiB
#include<bits/stdc++.h> using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> first; int input; first.push_back(1); for(int i=2;i<=n;i++){ cout << first.size()+1 << ' '; for(int j=0;j<first.size();j++){ cout << first[j] << ' '; } cout << i << endl; cin >> input; if(input==first.size()+1){ first.push_back(i); } } int ans[n+1]; memset(ans,0,sizeof(ans)); for(int i=0;i<first.size();i++){ ans[first[i]]=i+1; } for(int i=1;i<=n;i++){ if(ans[i]!=0){ continue; } int low=1,high=first.size(); low--; high++; while(high-low>1){ int mid=(high-low)/2+low; cout << mid+1 << ' '; for(int j=0;j<mid;j++){ cout << first[j] << ' '; } cout << i << endl; cin >> input; if(input==mid+1){ high=mid; } else{ low=mid; } } ans[i]=high; } cout << "0"; for(int i=1;i<=n;i++){ cout << ' ' << ans[i]; } }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |         for(int j=0;j<first.size();j++){
      |                     ~^~~~~~~~~~~~~
carnival.cpp:18:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         if(input==first.size()+1){
      |            ~~~~~^~~~~~~~~~~~~~~~
carnival.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<first.size();i++){
      |                 ~^~~~~~~~~~~~~
#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...