# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203881 | V003 | 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int n)
{
char a, b, c, d;
string s="";
int k=press("AB");
if(k)
{
k=press("A");
if(k){
a='A';
b='B';
c='X';
d='Y';
}
else
{
a='B';
b='A';
c='X';
d='Y';
}
}
else
{
k=press("Y");
if(k)
{
a='Y';
b='B';
c='X';
d='A';
}
else
{
a='X';
b='B';
c='A';
d='Y';
}
}
s+=a;
int l=1;
while(l<n)
{
k=press(s+b+s+c+c+s+c+b+s+c+d);
if(k==l)
s+=d;
if(k==l+1)
s+=b;
if(k==l+2)
s+=c;
l++;
}
return s;
}
int main()
{
string s;
cin>>s;
n=s.size();
cout<<guess_sequence(n);
}