# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1071005 | Tob | 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;
string guess_sequence(int n) {
string c = "ABXY";
vector <int> v = {0, 1, 2, 3};
string s;
int o;
if (press("AB")) o = press("B");
else o = 2+press("Y");
s += c[o];
v.erase(v.begin()+o, v.begin()+o+1);
for (int i = 1; i < n; i++) {
string t;
if (i == n-1) {
for (int j = 0; j < i; j++) t += s[j]; t += c[v[0]];
for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
if (press(t) == i) s += c[v[2]];
else s += c[v[press(t.substr(n, n))-i]];
continue;
}
for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
for (int k = 0; k < 3; k++) {
for (int j = 0; j < i; j++) t += s[j];
t += c[v[2]]; t += c[v[k]];
}
s += c[v[press(t)-i]];
}
return s;
}