#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N){
vector<string> b = {"A", "B", "X", "Y"};
string p, S = "";
int first;
if (press("XY") == 1){
if (press("X") == 1) first = 2;
else first = 3;
}
else {
if (press("A") == 1) first = 0;
else first = 1;
}
S += b[first];
b.erase(b.begin() + first);
for (int i = 1; i < N-1; i++){
p = (S + b[1]) + (S + b[2] + b[0]) + (S + b[2] + b[1]) + (S + b[2] + b[2]);
int coin = press(p);
S += b[coin - S.length()];
}
for (auto bi : b)
if (press(S + bi) == N){
S += bi;
break;
}
return S;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |