제출 #853522

#제출 시각아이디문제언어결과실행 시간메모리
853522lamter콤보 (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...