Submission #89653

#TimeUsernameProblemLanguageResultExecution timeMemory
89653asifthegreatCombo (IOI18_combo)C++14
5 / 100
2 ms328 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { int k = press("AB"); //debug(k); char first_letter = '['; if(k == 2){ first_letter = 'A'; } else if(k == 1){ if(press("B"))first_letter = 'B';//ABBXXYXYXYXYXYXYBBBBBBs else first_letter = 'A'; } else{ if(press("X"))first_letter = 'X'; else first_letter = 'Y'; } //debug(first_letter); string ss; if(first_letter != 'A' )ss.push_back('A'); if(first_letter != 'B' )ss.push_back('B'); if(first_letter != 'X' )ss.push_back('X'); if(first_letter != 'Y' )ss.push_back('Y'); //debug(ss); string ans; ans.push_back(first_letter); for(int i = 1; i < N-1;i++){ //debug(ans+ss[0]+ans+ss[1]+ss[0]+ans+ss[1]+ss[2]); k = press(ans+ss[0]+ans+ss[1]+ss[0]+ans+ss[1]+ss[2]+ans+ss[1]+ss[1]); //debug(k-i); if(k == i+2){ ans.push_back(ss[1]); } else if(k == i+1)ans.push_back(ss[0]); else ans.push_back(ss[2]); } int size = ans.size(); k = press(ans+ss[0]+ss[1]); if(k > size)ans.push_back(ss[0]); else{ k = press(ans+ss[1]+ss[2]); if(k > size)ans.push_back(ss[1]); else ans.push_back(ss[2]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...