# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411599 | nichke | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int press(string p);
string guess_sequence(int n) {
string but = "AB";
string res = "";
if (!press(but)) but = "XY";
char ff = but[0];
if (!press(but.substr(0, 1))) ff = but[1];
but = "ABXY";
string bt = "";
for (char c : but) {
if (c == ff) continue;
bt += c;
}
res += ff;
if (n <= 1) {
return res;
}
while (res.size() < n - 1)
res += bt[press(res + bt[1] + res + bt[2] + bt[0] + res + bt[2] + bt[1] + res + bt[2] + bt[2]) - res.size()];
}
if (press(res + bt[0] + res + bt[1])) {
if (press(res + bt[0]) > res.size()) return res + bt[0];
return res + bt[1];
}
return res + bt[2];
}