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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
std::string guess_sequence(int N) {
string S;
if(press("A")) {
S += "A";
}
else if(press("B")) {
S += "B";
}
else if(press("X")) {
S += "X";
}
else {
S += "Y";
}
string W = "ABXY", T;
for(int i=0; i<4; i++) {
if(S[0] != W[i]) T += W[i];
}
for(int i=1; i<N-1; i++) {
string one = S + T[0];
string q;
for(int j=0; j<3; j++) {
q += one;
q += T[j];
}
q += S;
q += T[1];
q += S[0];
int res = press(q);
if(res == i + 2) S += T[0];
else if(res == i + 1) S += T[1];
else S += T[2];
}
if(press(S + T[0]) == N) S += T[0];
else if(press(S + T[1]) == N) S += T[1];
else S += T[2];
cout << S << "\n";
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |