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;
vector<string> c(3);
string guess_sequence(int n)
{
string s="";
if (press("XY"))
{
if (press("X")) s="X";
else s="Y";
}
else
{
if (press("A")) s="A";
else s="B";
}
if (s=="X") c={"A","B","Y"};
else if (s=="Y") c={"A","B","X"};
else if (s=="A") c={"X","Y","B"};
else c={"X","Y","A"};
for (int i=1;i<n-1;i++)
{
int coins=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[1]+c[0]+s+c[1]+c[1]);
if (coins==i) s+=c[2];
else if (coins>=i+2)
{
if (press(s+c[0]+c[0]+s+c[1]+c[1])==n)
{
if (press(s+c[0]+c[0])==n) s+=c[0],s+=c[0];
else s+=c[1],s+=c[1];
}
else
{
if (press(s+c[0]+c[1])==n) s+=c[0],s+=c[1];
else s+=c[1],s+=c[0];
}
i++;
}
else
{
if (press(s+c[0])>=i+1) s+=c[0],s+=c[2];
else s+=c[1],s+=c[2];
}
}
if ((int)s.size()<n)
{
if (press(s+"X"+s+"Y")>n-1)
{
if (press(s+"X")>n-1) s+="X";
else s+="Y";
}
else
{
if (press(s+"A")>n-1) s+="A";
else s+="B";
}
}
//cout<<s<<endl;
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |