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;
const string buttons[4] = {"A", "B", "X", "Y"};
string guess_sequence(int N) {
int first = press("AB") ? press("B") : press("Y") + 2;
string res = buttons[first];
if (N == 1) {
return res;
}
vector<int> rem;
for (int i = 0; i < 4; i++) {
if (i != first) {
rem.push_back(i);
}
}
for (int i = 0; i < N - 2; i++) {
string seq = res + buttons[rem[1]];
for (int j = 0; j < 3; j++) {
seq += res + buttons[rem[2]] + buttons[rem[j]];
}
res += buttons[rem[press(seq) - i - 1]];
}
int last = press(res + "A" + res + "B") == N ? press(res + "B") - N + 1 : press(res + "Y") - N + 3;
res += buttons[last];
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |