# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937018 | Khalid_Alabdullatif | 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.
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pii pair<ll,int>
using namespace std;
string guess_sequence(int n){
string p;
char p1,p2,p3;
if(press("AB")){
if(press("A"))
p+='A',p1='B';
else
p+='B',p1='A';
p2='Y',p3='X';
}
else{
if(press("X"))
p+='X',p3='Y';
else
p+='Y',p3='X';
p1='A',p2='B';
}
if(n==1)
return p;
int sz=1;
for(int i=1;i<n-1;i++){
string tmp=p;
tmp+=p1+p1,tmp+=p,tmp+=p1+p2,tmp+=p,tmp+=p1+p3,tmp+=p,tmp+=p2;
int x=press(tmp);
if(x-sz==2)
p+=p1;
else if(x-sz==1)
p+=p2;
else
p+=p3;
sz=p.size();
}
if(press(p+p1)-sz)
p+=p1;
else
p+=(press(p+p2)-sz ? p2:p3);
return p;
}