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="",p;
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"};
while ((int)s.size()<n-1)
{
int i=(int)s.size();
int coins=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[1]+c[1]);
if (coins==i) s+=c[2];
else if (coins==i+1)
{
coins=press(s+c[1]+c[0]);
if (coins>=i+2) s+=c[1]+c[0];
else if (coins==i+1) s+=c[1]+c[2];
else s+=c[0]+c[2];
}
else
{
coins=press(s+c[0]+c[0]);
if (coins>=i+2) s+=c[0]+c[0];
else if (coins==i+1) s+=c[0]+c[1];
else s+=c[1]+c[1];
}
}
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... |