# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85520 | 2018-11-20T16:40:36 Z | JustasLe | Combo (IOI18_combo) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string ans = ""; string poss = "ABXY"; for (int i = 0; i < 4; i++) { string temp = "" + poss[i]; int cnt = press(temp); if (cnt > 0) { poss.erase(poss.begin() + i); ans += temp; break; } } if(N == 1) { return ans; } bool ok = true; int prev = 1; while (ok && (int) ans.Size() < N) { ok = false; for (int i = 0; i < 3; i++) { string newAns = ans + "" + poss[i]; int cnt = press(newAns); if(cnt > prev) { ans = newAns; ok = true; prev = cnt; break; } } } return ans; }