Submission #132474

#TimeUsernameProblemLanguageResultExecution timeMemory
132474nxteruCombo (IOI18_combo)C++14
0 / 100
2 ms212 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string ans; char c[3],d[4]={'A','B','X','Y'}; bool u[4]; string q; string guess_sequence(int n){ q+=d[0]; q+=d[1]; if(press(q)==1){ q.pop_back(); if(press(q)==1)u[0]=true; else u[1]=true; }else{ q.clear(); q.push_back(d[2]); if(press(q)==1)u[2]=true; else u[3]=true; } int k=0; for(int i=0;i<4;i++){ if(!u[i])c[k++]=d[i]; else ans.push_back(d[i]); } for(int i=2;i+1<=n;i++){ q.clear(); q+=ans; q.push_back(c[0]); for(int j=0;j<3;j++){ q+=ans; q.push_back(c[1]); q.push_back(c[j]); } int s=press(q); if(s==i-1)ans.push_back(c[2]); else if(s==i)ans.push_back(c[0]); else ans.push_back(c[1]); } if(ans.size()==n)return ans; q.clear(); q+=ans; q.push_back(c[0]); q+=ans; q.push_back(c[1]); if(press(q)==n){ q.clear(); q+=ans; q.push_back(c[0]); if(press(q)==n)ans.push_back(c[0]); else ans.push_back(c[1]); }else ans.push_back(c[2]); return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |   if(ans.size()==n)return ans;
      |      ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...