# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
570640 | kkkkkkkk | 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 <iostream>
using namespace std;
string guess_sequence(int N)
{
string rez;
char prva;
if (press("AB"))
{
if (press("A"))
rez="A",prva='A';
else
rez="B",prva='B';
}
else
{
if (press("X"))
rez="X",prva='X';
else
rez="Y",prva='Y';
}
for (int i=1;i<N;i++)
{
if (prva=='A')
{
if (press(rez+"B")==rez.size()+1)
rez+="B";
else if (press(rez+"X")==rez.size()+1)
rez+="X";
else
rez+="Y";
}
else if (prva=='B')
{
if (press(rez+"A")==rez.size()+1)
rez+="A";
else if (press(rez+"X")==rez.size()+1)
rez+="X";
else
rez+="Y";
}
else if (prva=='X')
{
if (press(rez+"A")==rez.size()+1)
rez+="A";
else if (press(rez+"B")==rez.size()+1)
rez+="B";
else
rez+="Y";
}
else
{
if (press(rez+"A")==rez.size()+1)
rez+="A";
else if (press(rez+"B")==rez.size()+1)
rez+="B";
else
rez+="X";
}
}
return rez;
}