# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
476346 | ponytail | 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.
#include "combo.h"
std::string guess_sequence(int N) {
string S;
if(press("A")) {
S += "A";
}
else if(press("B")) {
S += "B";
}
else if(press("X")) {
S += "X";
}
else {
S += "Y";
}
string W = "ABXY", T;
for(int i=0; i<4; i++) {
if(S[0] != W[i]) T += W[i];
}
for(int i=1; i<N-1; i++) {
string one = S + T[0];
string q;
for(int j=0; j<3; j++) {
q += one;
q += T[j];
}
q += S;
q += T[1];
q += S[0];
int res = press(q);
if(res == i + 2) S += T[0];
else if(res == i + 1) S += T[1];
else S += T[2];
}
if(press(S + T[0]) == N) S += T[0];
else if(press(S + T[1]) == N) S += T[1];
else S += T[2];
cout << S << "\n";
return S;
}