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"
using namespace std;
#define endl "\n"
string guess_sequence(int N) {
char A, B, X, Y;
if (press("AB") != 0){
if (press("B") == 1){
A = 'B';
B = 'A';
X = 'X';
Y = 'Y';
}
else{
A = 'A';
B = 'B';
X = 'X';
Y = 'Y';
}
}
else if (press("X") != 0){
A = 'X';
B = 'B';
X = 'A';
Y = 'Y';
}
else{
A = 'Y';
B = 'B';
X = 'X';
Y = 'A';
}
string S = "";
S += A;
if (N == 1){
return S;
}
for (int i = 0; i < N - 2; ++i){
int take = press(S + B + S + X + B + S + X + X + S + X + Y);
if (take == i + 1){
S += Y;
}
else if (take == i + 2){
S += B;
}
else{
S += X;
}
}
if (press(S + B) == N){
S += B;
}
else if (press(S + X) == N){
S += X;
}
else{
S += Y;
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |