Submission #594423

#TimeUsernameProblemLanguageResultExecution timeMemory
594423yutabiCombo (IOI18_combo)C++14
5 / 100
1 ms292 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { char start='A'; char buttons[]={'A','B','X'}; string ans=""; string query=""; if(press("AB")) { if(press("A")) { start='A'; } else { start='B'; } } else { if(press("X")) { start='X'; } else { start='Y'; } } if(buttons[0]==start) { swap(buttons[0],buttons[1]); } if(buttons[1]==start) { swap(buttons[2],buttons[1]); } if(buttons[2]==start) { buttons[2]='Y'; } ans+=start; for(int i=1;i<N-1;i++) { query=ans+buttons[0]+buttons[0]+ans+buttons[0]+buttons[1]+ans+buttons[0]+buttons[2]+ans+buttons[1]; //cout << query << endl; int res=press(query); if(res==i) { ans+=buttons[2]; } if(res==i+1) { ans+=buttons[1]; } if(res==i+2) { ans+=buttons[0]; } } if(press(ans+buttons[0])==N) { ans+=buttons[0]; } else if(press(ans+buttons[1])==N) { ans+=buttons[1]; } else { ans+=buttons[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...