# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136682 | WongHokFong_cpp | 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>
#include <cstdio>
#include "combo.h"
#include <string>
using namespace std;
string a,b,c;
int visited[5];
string guess_sequence(int N)
{
string ans;
if (press("AB")>=1)
{
if (press("A")==1)
{
ans+="A";
a="B",b="X",c="Y";
}
else
{
ans+="B";
a="A",b="X",c="Y";
}
}
else
{
if (press("X")==1)
{
ans+="X";
a="A",b="B",c="Y";
}
else
{
ans+="Y";
a="A",b="B",c="X";
}
}
for (int i=2;i<=n-1;i++)
{
int rec=press(ans+a+ans+b+c+ans+b+a+ans+b+b);
if (rec==i+1) ans+=a;
else if (rec==i+2) ans+=b;
else ans+=c;
}
int rec=press(ans+a);
if (rec==n)
{
ans+=a;return ans;
}
int rec=press(ans+b);
if (rec==n)
{
ans+=b;return ans;
}
ans+=c;return ans;
}