Submission #119009

#TimeUsernameProblemLanguageResultExecution timeMemory
119009HungAnhGoldIBO2020Carnival (CEOI14_carnival)C++14
100 / 100
22 ms384 KiB
#include<bits/stdc++.h> #define int long long using namespace std; set<int> lis; set<int> cac1; vector<int> fuck; int ans[152]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); srand(time(0)); int n,i,j,k,l,now,now1,ohyeah=0; cin>>n; cout<<n<<" "; for(i=1;i<=n;i++){ cout<<i<<" "; lis.insert(i); } cout<<endl; cin>>now; while(lis.size()&&now!=1){ k=0; while(k<=1000){ j=(rand()*rand())%n+1; if(lis.count(j)){ lis.erase(lis.find(j)); cout<<lis.size()<<" "; for(auto ite=lis.begin();ite!=lis.end();ite++){ cout<<*ite<<" "; } cout<<endl; cin>>now1; if(now!=now1){ ohyeah++; ans[j]=ohyeah; for(auto ite=cac1.begin();ite!=cac1.end();ite++){ cout<<"2 "<<j<<" "<<*ite<<endl; cin>>l; if(l==1){ ans[*ite]=ohyeah; fuck.push_back(*ite); } } for(i=0;i<fuck.size();i++){ cac1.erase(fuck[i]); } fuck.clear(); } else{ cac1.insert(j); } now=now1; break; } k++; if(k==1001){ auto ite=lis.begin(); j=*ite; lis.erase(lis.find(j)); cout<<lis.size()<<" "; for(auto ite=lis.begin();ite!=lis.end();ite++){ cout<<*ite<<" "; } cout<<endl; cin>>now1; if(now!=now1){ ohyeah++; ans[j]=ohyeah; for(auto ite=cac1.begin();ite!=cac1.end();ite++){ cout<<"2 "<<j<<" "<<*ite<<endl; cin>>l; if(l==1){ ans[*ite]=ohyeah; fuck.push_back(*ite); } } for(i=0;i<fuck.size();i++){ cac1.erase(fuck[i]); } fuck.clear(); } else{ cac1.insert(j); } now=now1; } } } ohyeah++; cout<<"0 "; for(i=1;i<=n;i++){ if(!ans[i]){ cout<<ohyeah<<" "; } else{ cout<<ans[i]<<" "; } } cout<<endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:44:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(i=0;i<fuck.size();i++){
              ~^~~~~~~~~~~~
carnival.cpp:77:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(i=0;i<fuck.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...