Submission #853526

#TimeUsernameProblemLanguageResultExecution timeMemory
853526lamterCombo (IOI18_combo)C++17
100 / 100
12 ms1748 KiB
#include "combo.h" #include <bits/stdc++.h> std::string guess_sequence(int n) { std::vector <char> KEYS = {'A', 'B', 'X', 'Y'}; std::string ans = press("AB") ? press("A") ? "A" : "B" : press("X") ? "X" : "Y"; KEYS.erase(std::find(KEYS.begin(), KEYS.end(), ans[0])); while ((int) ans.size() <= n - 2) { int t = press(ans + KEYS[0] + KEYS[0] + ans + KEYS[0] + KEYS[1] + ans + KEYS[1] + KEYS[0]); if (t == (int) ans.size()) ans = ans + KEYS[2]; if (t == (int) ans.size() + 1) { int tt = press(ans + KEYS[1] + KEYS[2]); if (tt == (int) ans.size()) ans = ans + KEYS[0] + KEYS[2]; if (tt == (int) ans.size() + 1) ans = ans + KEYS[1] + KEYS[1]; if (tt == (int) ans.size() + 2) ans = ans + KEYS[1] + KEYS[2]; } if (t == (int) ans.size() + 2) { int tt = press(ans + KEYS[0] + KEYS[0]); if (tt == (int) ans.size()) ans = ans + KEYS[1] + KEYS[0]; if (tt == (int) ans.size() + 1) ans = ans + KEYS[0] + KEYS[1]; if (tt == (int) ans.size() + 2) ans = ans + KEYS[0] + KEYS[0]; } } while ((int) ans.size() != n) { if (press(ans + KEYS[0]) != (int) ans.size()) { ans = ans + KEYS[0]; break; } if (press(ans + KEYS[1]) != (int) ans.size()) { ans = ans + KEYS[1]; break; } ans = ans + KEYS[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...