Submission #770229

#TimeUsernameProblemLanguageResultExecution timeMemory
770229boyliguanhanCombo (IOI18_combo)C++17
100 / 100
27 ms508 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string str; int res; char a,b,c; if(press("AB")) if(press("A")) str="A",a='B',b='X',c='Y'; else str="B",a='A',b='X',c='Y'; else if(press("X")) str = "X",a='Y',b='A',c='B'; else str = "Y",a='X',b='A',c='B'; if(N==1) return str; for(int i = 1; i < N-1; i++) { res = press(str+a+str+b+a+str+b+b+str+b+c); if(res==i) str+=c; if(res==i+1) str+=a; if(res==i+2) str+=b; } if(press(str+a)==N) str+=a; else if(press(str+b)==N) str+=b; else str+=c; return str; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...