# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1129898 | pedreitorzelda | Combo (IOI18_combo) | C++20 | 0 ms | 0 KiB |
std::string guess_sequence(int N){
std::string ans;
std::vector<char>possible = {'A','B','X','Y'};
for(int i=0;i<N;i++){
if(i==0){
for(int j=0;j<3;j++){
std::string q(N,possible[j]);
int tmp = press(q);
if(tmp==1){
ans+=possible[j];
break;
}
}if(ans.size()==i)ans+=possible[3];
}else{
for(int j=0;j<3;j++){
std::string q(N-i-1,ans[0]);
std::string qu = ans+possible[j]+q;
int tmp = press(qu);
if(tmp==1){
ans+=possible[j];
break;
}
}if(ans.size()==i)ans+=possible[3];
}
}
return ans;
}