#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
string p;
string x;
if (press("AB"))
if (press("A"))
x = "BXY", p = "A";
else
x = "AXY", p = "B";
else if (press("X"))
x = "ABY", p = "X";
else
x = "ABX", p = "Y";
if (n == 1)
return p;
for (int i = 2; i < n; i++)
{
int pref = press(p + x[0] + x[0] + p + x[0] + x[1] + p + x[0] + x[2] + p + x[1]);
if (pref == i + 1)
{
p += x[0];
}
else if (pref == i)
{
p += x[1];
}
else
{
p += x[2];
}
}
if (press(p + x[0]) == n)
{
p += x[0];
}
else if (press(p + x[1]) == n)
{
p += x[1];
}
else
{
p += x[2];
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |