Submission #594435

#TimeUsernameProblemLanguageResultExecution timeMemory
594435yutabiCombo (IOI18_combo)C++14
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string start; string buttons[3]; buttons[0]="A"; buttons[1]="B"; buttons[2]="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"; } //cout << start << ' ' << buttons[0] << ' ' << buttons[1] << ' ' << buttons[2] << endl; ans=start; for(int i=1;i<N-1;i++) { query=ans; query+=buttons[0]; query+=buttons[0]; query+=ans; query+=buttons[0]; query+=buttons[1]; query+=ans; query+=buttons[0]; query+=buttons[2]; query+=ans; query+=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...