# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
771050 | nnin | 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 S;
string opt;
if(press("AB")) {
if(press("A")) {
S = "A";
opt = "BXY";
} else {
S = "B";
opt = "AXY";
}
} else {
if(press("X")) {
S = "X";
opt = "ABY";
} else {
S = "Y";
opt = "ABX";
}
}
for(int i=1;i<N-1;i++) {
/*if(press(S+opt[0])>i) {
S += opt[0];
} else if(press(S+opt[1])>i) {
S += opt[1];
} else {
S += opt[2];
}*/
string tmp = S+opt[0]+opt[0]+S+opt[0]+opt[1]+S+opt[0]+opt[2]+S+opt[1];
int ct = press(tmp);
if(ct>i+1) {
S += opt[0];
} else if(ct==i+1) {
S += opt[1];
} else {
S += opt[2];
}
}
if(press(S+opt[0])==N) {
S += opt[0];
} else if(press(S+opt[1])==N) {
S += opt[1];
} else {
S += opt[2];
}
return S;
}