# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
210587 | grobar | 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"
std::string guess_sequence(int n) {
string ss="";
int a1=press("A");
if(a1==1)
{
ss=ss+"A";
for(int i=1;i<n;i++)
{
string ss1=ss+"B";
if(press(ss1)==(i+1))
{
ss=ss+"B";
if(ss.size()==n)
{
break;
}
}
string ss2=ss+"X";
if(press(ss2)==i+1)
{
ss=ss+"X";
if(ss.size()==n)
{
break;
}
}
string ss3=ss+"Y"
if(press(ss3)==i+1)
{
ss=ss+"Y";
if(ss.size()==n)
{
break;
}
}
}
}
int a2=press("B");
if(a2==1)
{
ss=ss+"B";
for(int i=1;i<n;i++)
{
string ss4=ss+"A";
if(press(ss4)==i+1)
{
ss=ss+"A";
if(ss.size()==n)
{
break;
}
}string ss5=ss+"X";
if(press(ss5)==i+1)
{
ss=ss+"X";
if(ss.size()==n)
{
break;
}
}
string ss6=ss+"Y";
if(press(ss6)==i+1)
{
ss=ss+"Y";
if(ss.size()==n)
{
break;
}
}
}
}
int a3=press("X");
if(a3==1)
{
ss=ss+"X";
for(int i=1;i<n;i++)
{
string ss7=ss+"A";
if(press(ss7)==i+1)
{
ss=ss+"A";
if(ss.size()==n)
{
break;
}
}
string ss8=ss+"B";
if(press(ss8)==i+1)
{
ss=ss+"B";
if(ss.size()==n)
{
break;
}
}
string ss9=ss+"Y";
if(press(ss9)==i+1)
{
ss=ss+"Y";
if(ss.size()==n)
{
break;
}
}
}
}
int a4=press("Y");
if(a4==1)
{
ss=ss+"Y";
for(int i=1;i<n;i++)
{
string ss10=ss+"A";
if(press(ss10)==i+1)
{
ss=ss+"A";
if(ss.size()==n)
{
break;
}
}
string ss11=ss+"X";
if(press(ss11)==i+1)
{
ss=ss+"X";
if(ss.size()==n)
{
break;
}
}
string ss12=ss+"B";
if(press(ss12)==i+1)
{
ss=ss+"B";
if(ss.size()==n)
{
break;
}
}
}
}
return ss;
}