Submission #335307

#TimeUsernameProblemLanguageResultExecution timeMemory
335307fadi57Combo (IOI18_combo)C++14
100 / 100
112 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> //#include"grader.cpp" using namespace std; std::string guess_sequence(int N) { std::string p = ""; string s="ABXY"; string first; int query=press("AB"); string ret; if(query){ ret=press("A")?"A":"B"; }else{ ret=press("X")?"X":"Y"; } first=ret; s.erase(find(s.begin(),s.end(),first[0])); //cout<<s<<endl; int si=N;si--; int now=2; for(int i=2;i<N;i++){ string tr=ret+s[0]+ret+s[1]+s[0]+ret+s[1]+s[1]+ret+s[1]+s[2]; //cout<<"DEBUG "<<tr<<endl; query=press(tr); if(query==now){ret+=s[0];}else if(query==(now+1)){ret+=s[1];}else{ret+=s[2];} now++; }if(ret.size()==N){return ret;} if(press(ret+s[0])==N){ ret+=s[0]; }else if(press(ret+s[1])==N){ret+=s[1];}else{ ret+=s[2]; }//cout<<ret<<endl; return ret; }

Compilation message (stderr)

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