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 <iostream>
#define ll long long
using namespace std;
std::string guess_sequence(int N) {
string S, T, X;
ll x = press("AB");
if (x >= 1) {
X += "XY";
x = press("A");
if (x >= 1) S += 'A', X += 'B';
else S += 'B', X += 'A';
}
else {
X += "AB";
x = press("X");
if (x >= 1) S += 'X', X += 'Y';
else S += 'Y', X += 'X';
}
if (N == 1) return S;
for (int i=1; i<N-1; ++i) {
T = S + X[0] + X[0];
T += S + X[0] + X[1];
T += S + X[0] + X[2];
T += S + X[1];
x = press(T);
if (x-i == 0) {
S += X[2];
}
else if (x-i == 1) {
S += X[1];
}
else S += X[0];
}
T = S + X[0];
T += S + X[1];
x = press(T);
if (x == N-1) S += X[2];
else {
x = press(S+X[0]);
if (x == N-1) S += X[1];
else S += X[0];
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |