# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
367798 | mashrur_hossain | 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 a = "ABXY";
if(press("AB")){
if(press("A")){
a.erase(a.begin());
s+="A";
}
else{
a.erase(a.begin()+1);
s+="B";
}
}
else{
if(press("X")){
a.erase(a.begin()+2);
s+='X';
}
else{
s+="Y";
a.erase(a.begin()+3);
}
}
// D(s);
for(int i = 1;i<n-1;i++){
string guess = "";
for(int j = 0;j<4;j++){
guess+= s + a[0] + a[j];
}
guess+=s+a[1];
int x = press(guess);
if(x == i)s+=a[2];
else if(x==i+1)s+=a[1];
else if(x==i+2)s+=a[0];
}
if(press(s+a[0]+s+a[1]) == n){
if(press(s+a[0]) == n){
s+= a[0];
}else{
s+=a[1];
}
}
else{
s+=a[2];
}
return s;
}