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>
#include "combo.h"
#define pb push_back
#define ll long long
#define x first
#define y second
using namespace std;
string guess_sequence(int n)
{
string ret="";
string c[3];
int gt=press("AB");
if(gt)
{
gt=press("A");
if(gt) ret+="A", c[0]="B", c[1]="X", c[2]="Y";
else ret+="B", c[0]="A", c[1]="X", c[2]="Y";
}
else
{
gt=press("X");
if(gt) ret+="X", c[0]="A", c[1]="B", c[2]="Y";
else ret+="Y", c[0]="A", c[1]="X", c[2]="B";
}
if(n==1) return ret;
for(int i=1;i<n;i++)
{
gt=press(ret+c[0]+c[0]+ret+c[0]+c[1]+ret+c[0]+c[2]+ret+c[1]);
if(gt==i) ret+=c[2];
else if(gt==i+1) ret+=c[1];
else ret+=c[0];
}
gt=press(ret+c[0]);
if(gt==n) return ret+c[0];
else
{
gt=press(ret+c[1]);
if(gt==n) return ret+c[1];
return ret+c[2];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |