# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
210574 | 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 <bits/stdc++.h>
using namespace 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++)
{
if(press(ss+"B")==i+1)
{
ss=ss+"B";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"X")==i+1)
{
ss=ss+"X";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"Y")==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++)
{
if(press(ss+"A")==i+1)
{
ss=ss+"A";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"X")==i+1)
{
ss=ss+"X";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"Y")==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++)
{
if(press(ss+"A")==i+1)
{
ss=ss+"A";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"B")==i+1)
{
ss=ss+"B";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"Y")==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++)
{
if(press(ss+"A")==i+1)
{
ss=ss+"A";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"X")==i+1)
{
ss=ss+"X";
if(ss.size()==n)
{
break;
}
}
if(press(ss+"B")==i+1)
{
ss=ss+"B";
if(ss.size()==n)
{
break;
}
}
}
}
return ss;
}