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 <vector>
using namespace std;
string guess_sequence(int N)
{
string curr = "";
string other;
if (press("AB"))
{
if (press("A"))
{
curr.push_back('A');
other = "BXY";
}
else
{
curr.push_back('B');
other = "AXY";
}
}
else
{
if (press("X"))
{
curr.push_back('X');
other = "ABY";
}
else
{
curr.push_back('Y');
other = "ABX";
}
}
for (int i = 1; i < N - 1; i++)
{
string ask = curr + other[0] + curr + other[1] + other[0] + curr + other[1] + other[1] + curr + other[1] + other[2];
int res = press(ask);
if (res == i)
{
curr.push_back(other[2]);
}
else if (res == i + 1)
{
curr.push_back(other[0]);
}
else
{
curr.push_back(other[1]);
}
}
if (press(curr + other[0] + curr + other[1]) != N)
{
return curr + other[2];
}
else if (press(curr + other[0]) == N) return curr + other[0];
return curr + other[1];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |