# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
439187 | Idkwhoami | 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.
string guess_sequence(int N) {
string ans = "Y";
vector<string> tf = {"A", "B", "X"}, all = {"A", "B", "X", "Y"};
for(auto t:tf){
int x = press(t);
if(x == 1) {
ans = t;
break;
}
}
vector<string> possible;
for(auto t:all){
if(t != ans)possible.push_back(t);
}
string start = ans;
if(N == 1)ans;
while(ans.size() != N){
string test1 = ans + possible[0] + ans + possible[1];
int x = press(test1);
if(x == ans.size()){
ans = ans + possible[2];
}
else{
x = press(ans + possible[0]);
if(x == ans.size())ans = ans + possible[1];
else ans = ans + possible[0];
}
}
return ans;
}