#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
char lst[7] = {'A', 'B', 'X', 'Y', 'A', 'B', 'X'};
char stopper = 0;
std::string guess_sequence(int N) {
string S;
int a = press("AB");
if (a){
a = press("B");
if (a){
stopper = 1;
S = "B";
}else{
stopper = 0;
S = "A";
}
}else{
a = press("X");
if (a){
stopper = 2;
S = "X";
}else{
stopper = 3;
S = "Y";
}
}
for (int i = S.size(); i < N; i++){
if (i < N - 1){
int c = press(S + lst[stopper + 1] + S + lst[stopper + 2] + lst[stopper + 1] + S + lst[stopper + 2] + lst[stopper + 2] + S + lst[stopper + 2] + lst[stopper + 3]);
if (c == S.size()){
S = S + lst[stopper + 3];
}else if (c == S.size() + 1){
S = S + lst[stopper + 1];
}else{
S = S + lst[stopper + 2];
}
}else{
int a = press(S + lst[stopper + 1] + S + lst[stopper + 2]);
if (a > S.size()){
a = press(S + lst[stopper + 1]);
if (a > S.size()){
return S + lst[stopper + 1];
}
return S + lst[stopper + 2];
}
return S + lst[stopper + 3];
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |