Submission #292263

#TimeUsernameProblemLanguageResultExecution timeMemory
292263ahadvigerCombo (IOI18_combo)C++14
97 / 100
42 ms700 KiB
#include "combo.h" #include <iostream> std::string guess_sequence(int N) { std::string p = ""; std::string S = ""; std::string a, b, c; if (N == 1) { if (press("A") == 1) return "A"; if (press("B") == 1) return "B"; if (press("X") == 1) return "X"; if (press("Y") == 1) return "Y"; } p = "AB"; int res = press(p); if (res > 0) { p = "AXAYAAAB"; res = press(p); if (res == 2) { S = "A"; a = "B"; b = "X", c = "Y"; } else { S = "B"; a = "A"; b = "X", c = "Y"; } } else { p = "XAXBXXXY"; res = press(p); if (res == 2) { S = "X"; a = "B"; b = "A", c = "Y"; } else { S = "Y"; a = "B"; b = "X", c = "A"; } } for (int i = 1; i < N - 1; ++i) { p = S + a + a + S + a + b + S + a + c + S + b; res = press(p); if (res == i + 2) S += a; if (res == i + 1) S += b; if (res == i) S += c; } p = S + a; if (press(p) == N) return p; p = S + b; if (press(p) == N) return p; return S + c; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...