Submission #713103

#TimeUsernameProblemLanguageResultExecution timeMemory
713103onepunchac168Combo (IOI18_combo)C++14
100 / 100
39 ms576 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef int ll; std::string guess_sequence(int N) { string s=""; ll pp=press(s+"A"+s+"B"); if (pp>=1) { ll aa=press(s+"A"); if (aa>=1) { s+="A"; } else s+="B"; } else { ll aa=press(s+"X"); if (aa>=1) { s+="X"; } else s+="Y"; } char a1,a2,a3; if (s[0]=='A') { a1='B'; a2='X'; a3='Y'; } else if (s[0]=='B') { a1='A'; a2='X'; a3='Y'; } else if (s[0]=='X') { a1='A'; a2='B'; a3='Y'; } else { a1='A'; a2='B'; a3='X'; } if (N==1) { return s; } for (int i=2;i<=N-1;i++) { string gg=s; gg+=a1; gg+=s; gg+=a2; gg+=a1; gg+=s; gg+=a2; gg+=a2; gg+=s; gg+=a2; gg+=a3; ll rr=press(gg)-i+1; if (rr==1) { s+=a1; } else if (rr==2) { s+=a2; } else s+=a3; } string gg=s; gg+=a1; if (press(gg)==N) { s=gg; } else { string tmp=s; tmp+=a2; if (press(tmp)==N) { s=tmp; } else s+=a3; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...