Submission #951849

#TimeUsernameProblemLanguageResultExecution timeMemory
951849karpatkaCombo (IOI18_combo)C++17
100 / 100
12 ms1908 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string s; char a, b, c, d; if (press("AB") > 0) { c = 'X', d = 'Y'; if (press("A")) { a = 'A'; b = 'B'; } else { a = 'B'; b = 'A'; } } else { c = 'A', d = 'B'; if (press("X")) { a = 'X'; b = 'Y'; } else { a = 'Y'; b = 'X'; } } s += a; if (N == 1) { return s; } for (int i = 1; i < N - 1; i++) { int k = press(s + b + b + s + b + c + s + b + d + s + c); if (k == i) { s += d; } else if (k == i + 1) { s += c; } else if (k == i + 2) { s += b; } } if (press(s + b) == N) { s += b; } else if (press(s + c) == N) { s += c; } else { s += d; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...