Submission #853522

#TimeUsernameProblemLanguageResultExecution timeMemory
853522lamterCombo (IOI18_combo)C++17
0 / 100
31 ms344 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) ans = ans + (press(ans + KEYS[0]) == (int) ans.size() ? KEYS[1] : KEYS[0]) + 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 += KEYS[0]; break; } if (press(ans + KEYS[1]) != (int) ans.size()) { ans += KEYS[1]; break; } ans += KEYS[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...