# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138424 | degelo | 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.
using namespace std;
string a[4];
int first;
string s;
/*int press(string a){
int resp;
cout<<a;
cin>>resp;
return resp;
}*/
string guess_sequence(int n){
a[0]="A",a[1]="B",a[2]="X",a[3]="Y";
if(press(a[0]+a[1])>=1){
if(press(a[0])==1){
first=0;
s+=a[0];
}
else{
first=1;
s+=a[1];
}
}
else{
if(press(a[2])==1){
first=2;
s+=a[2];
}
else{
first=3;
s+=a[3];
}
}
vector<string> b;
for(int i=0;i<4;i++){
if(i!=first) b.push_back(a[i]);
}
for(int i=1;i<n-1;i++){
string st=s+b[0]+b[0]+s+b[0]+b[1]+s+b[0]+b[2]+s+b[1];
int t=press(st);
if(t==s.size()){
s+=b[2];
}
if(t==s.size()+1){
s+=b[1];
}
if(t==s.size()+2){
s+=b[0];
}
}
if(n>1){
if(press(s+b[0])==n) s+=b[0];
else if(press(s+b[1])==n) s+=b[1];
else s+=b[2];
}
return s;
}
/*int main(){
int n;
cin>>n;
guess_sequence(n);
}*/