Submission #937027

#TimeUsernameProblemLanguageResultExecution timeMemory
937027Khalid_AlabdullatifCombo (IOI18_combo)C++14
100 / 100
16 ms1896 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ string p=""; string p1,p2,p3; if(press("AB")){ if(press("A")) p+="A",p1="B"; else p+="B",p1="A"; p2="Y",p3="X"; } else{ if(press("X")) p+="X",p3="Y"; else p+="Y",p3="X"; p1="A",p2="B"; } if(n==1) return p; int sz=1; for(int i=1;i<n-1;i++){ string tmp=(p+p1+p1)+(p+p1+p2)+(p+p1+p3)+(p+p2); int x=press(tmp); if(x-sz==2) p+=p1; else if(x-sz==1) p+=p2; else p+=p3; sz=p.size(); } if(press(p+p1)-sz) p+=p1; else p+=(press(p+p2)-sz ? p2:p3); return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...