Submission #592124

#TimeUsernameProblemLanguageResultExecution timeMemory
592124JJAnawatCombo (IOI18_combo)C++14
100 / 100
32 ms696 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string button[4]={"A","B","X","Y"}; string guess_sequence(int N){ string ans=""; if(press("AB")){ ans=(press("A"))?"A":"B"; } else{ ans=(press("X"))?"X":"Y"; } if(N==1) return ans; vector<string> rd; for(int i=0;i<4;i++){ if(button[i]!=ans) rd.push_back(button[i]); } for(int i=1;i<N-1;i++){ int scr=press(ans+rd[0]+ans+rd[1]+rd[0]+ans+rd[1]+rd[1]+ans+rd[1]+rd[2]); //AB AXB AXY AXZ //else AY int sz=ans.size(); if(scr==sz+1) ans+=rd[0]; else if(scr==sz+2) ans+=rd[1]; else ans+=rd[2]; } if(press(ans+rd[0]+ans+rd[1])==ans.size()+1){ if(press(ans+rd[0])-ans.size()) ans+=rd[0]; else ans+=rd[1]; } else ans+=rd[2]; return ans; }

Compilation message (stderr)

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