제출 #162010

#제출 시각아이디문제언어결과실행 시간메모리
162010apostoldaniel854콤보 (IOI18_combo)C++14
100 / 100
50 ms576 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence (int n) { string s = "AB"; string ans; if (press (s)) { if (press ("A")) ans += 'A'; else ans += 'B'; } else { if (press ("X")) ans += 'X'; else ans += 'Y'; } string c; if (ans[0] != 'A') c += 'A'; if (ans[0] != 'B') c += 'B'; if (ans[0] != 'X') c += 'X'; if (ans[0] != 'Y') c += 'Y'; for (int i = 1; i < n - 1; i++) { string p = ans + c[0] + ans + c[1] + c[0] + ans + c[1] + c[1] + ans + c[1] + c[2]; int w = press (p); if (w == i + 1) ans += c[0]; if (w == i + 2) ans += c[1]; if (w == i) ans += c[2]; } if (n > 1) { if (press (ans + c[0]) == n) ans += c[0]; else if (press (ans + c[1]) == n) ans += c[1]; else ans += c[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...