# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
485718 | dongliu0426 | 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.
using namespace std;
string guess_sequence(int N) {
string s, c0, c1, c2;
if (press("AB")) {
if (press("A"))
s = "a", c0 = "b", c1 = "x", c2 = "y";
else
s = "b", c0 = "a", c1 = "x", c2 = "y";
} else {
if (press("X"))
s = "x", c0 = "a", c1 = "b", c2 = "y";
else
s = "y", c0 = "a", c1 = "b", c2 = "x";
}
for (int i = 1; i + 1 < N; i++) {
int k = press(s + c0 + s + c1 + c0 + s + c1 + c1 + s + c1 + c2) - (int) s.size();
if (k == 0)
s += c2;
else if (k == 1)
s += c0;
else
s += c1;
}
if (N > 1) {
if (press(s + c0) == N)
s += c0;
else if (press(s + c1) == N)
s += c1;
else
s += c2;
}
return s;
}