제출 #413585

#제출 시각아이디문제언어결과실행 시간메모리
413585timmyfeng콤보 (IOI18_combo)C++17
5 / 100
1 ms200 KiB
#include <bits/stdc++.h> using namespace std; #include "combo.h" string guess_sequence(int n) { string ans; if (press("AB") > 0) { ans = press("A") > 0 ? "A" : "B"; } else { ans = press("X") > 0 ? "X" : "Y"; } string buttons = "ABXY"; buttons.erase(find(buttons.begin(), buttons.end(), ans[0])); for (int i = 1; i < n - 1; ++i) { string ask = ans + buttons[1]; for (int j = 0; j < 3; ++j) { ask += ans + buttons[2] + buttons[j]; } int res = press(ask); for (int j = 0; j < 3; ++j) { if (res == i + j) { ans += buttons[j]; } } } for (int i = 0; i < 2; ++i) { if (press(ans + buttons[i]) == n) { return ans + buttons[i]; } } return ans + buttons[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...