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;
std::string guess_sequence(int N) {
string S;
vector<char> cs;
if(press("AB") > 0){
if(press("A") == 1){
S = "A";
cs = {'B', 'X', 'Y'};
}else{
S = "B";
cs = {'A', 'X', 'Y'};
}
}else{
if(press("X") == 1){
S = "X";
cs = {'B', 'A', 'Y'};
}else{
S = "Y";
cs = {'B', 'X', 'A'};
}
}
//cout << S << endl;
if(N == 1) return S;
for(int i = 1; i < N-1; i++){
string p = S + cs[0] + S + cs[1] + cs[0] + S + cs[1] + cs[1] + S + cs[1] + cs[2];
int c = press(p);
if(c == i){
S += cs[2];
}else if(c == i + 1){
S += cs[0];
}else{
S += cs[1];
}
}
if(press(S + "A" + S + "B") == N){
if(press(S + "A") == N){
S += "A";
}else{
S += "B";
}
}else{
if(press(S + "X") == N){
S += "X";
}else{
S += "Y";
}
}
//cout << S << endl;
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |