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;
namespace
{
} // namespace
string guess_sequence(int N)
{
string alpha = "ABXY";
char c =
press("AB") > 0
? press("A")
? 'A'
: 'B'
: press("X")
? 'X'
: 'Y';
alpha.erase(alpha.find(c), 1);
string res = "";
res += c;
for (int i = 1; i < N; i++)
{
if (i == N - 1)
{
res +=
press(res + alpha[0]) == N
? alpha[0]
: press(res + alpha[1]) == N
? alpha[1]
: alpha[2];
}
else
{
int coins = press(res + alpha[0] + res + alpha[1] + alpha[0] + res + alpha[1] + alpha[1] + res + alpha[1] + alpha[2]);
if (coins == i + 2)
res += alpha[1];
else if (coins == i + 1)
res += alpha[0];
else
res += alpha[2];
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |