#include "combo.h"
#include <unordered_set>
#include <unordered_map>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <numeric>
using namespace std;
std::string guess_sequence(int N) {
string S = "";
vector<char> btns = {'X','Y','B','A'};
int frstidx = -1;
while (S.length() != N) {
if (S.length() == 0) {
for (size_t i = 0; i < 4; i++) {
string st;
st += btns[i];
int coin = press(st);
if (coin == 1) {
frstidx = i;
S += btns[i];
break;
}
}
} else {
for (size_t i = 0; i < 4; i++) {
if (i != frstidx) {
string st = S+btns[i];
int coin = press(st);
if (coin == S.length()+1) {
S += btns[i];
break;
}
}
}
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |