Submission #828252

#TimeUsernameProblemLanguageResultExecution timeMemory
828252vnm06Combo (IOI18_combo)C++14
100 / 100
20 ms620 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { string res=""; int t=press("AB"); if(t) { t=press("A"); if(t) res="A"; else res="B"; } else { t=press("X"); if(t) res="X"; else res="Y"; } if(N==1) return res; char b1='A', b2='B', b3='X'; if(res[0]=='A') b1='Y'; if(res[0]=='B') b2='Y'; if(res[0]=='X') b3='Y'; for(int j=2; j<=N-1; j++) { int t=press(res+b1+b1+res+b1+b2+res+b1+b3+res+b2); if(t==j-1) res+=b3; else if(t==j) res+=b2; else res+=b1; } if(press(res+b1)==N) return res+b1; if(press(res+b2)==N) return res+b2; return res+b3; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...