Submission #225913

#TimeUsernameProblemLanguageResultExecution timeMemory
225913frodakcinCombo (IOI18_combo)C++11
100 / 100
43 ms576 KiB
#include "combo.h" #include <algorithm> using string = std::string; string guess_sequence(int N) { string p = ""; string S = ""; char c[5] = "ABXY"; if(N == 1) { if(press("A")) return "A"; else if(press("B")) return "B"; else if(press("X")) return "X"; else return "Y"; } if(press("XY")) std::swap(c[0], c[2]), std::swap(c[1], c[3]); p += c[1]; if(press(p)) std::swap(c[0], c[1]); S += c[0]; for(int i = 1;i < N-1;++i) { p = ""; p += S + c[1]; p += S + c[2] + c[1]; p += S + c[2] + c[2]; p += S + c[2] + c[3]; int v = press(p); if(v == i+1) S += c[1]; else if(v == i+2) S += c[2]; else S += c[3]; } if(press(S + c[1]) == N) S += c[1]; else if(press(S + c[2]) == N) S += c[2]; else S += c[3]; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...