# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
595116 | thezomb1e | Combo (IOI18_combo) | C++17 | 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.
const string ABC = "ABXY";
string nABC;
string guess_sequence(int n) {
string ans;
int skip;
{
string cur;
for (int i = 0; i < 4; i++) {
cur += ABC[i];
}
if (press(cur.substr(0, 2))) {
if (press(cur.substr(0, 1))) {
skip = 0;
} else {
skip = 1;
}
} else {
if (press(cur.substr(2, 1))) {
skip = 2;
} else {
skip = 3;
}
}
ans.pb(ABC[skip]);
}
for (int i = 0; i < 4; i++) {
if (i == skip) continue;
nABC.pb(ABC[i]);
}
for (int it = 2; it <= n; it++) {
string cur;
int sz = ans.size();
for (int i = 0; i < 3; i++) {
cur += ans;
cur += nABC[i];
}
if (press(cur.substr(0, 2 * (sz + 1))) == it) {
if (press(cur.substr(0, sz + 1)) == it) {
ans.pb(nABC[0]);
} else {
ans.pb(nABC[1]);
}
} else {
ans.pb(nABC[2]);
}
}
return ans;
}