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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string all = "ABXY";
int pos = press("AB") ? press("B") : press("Y") + 2;
string curr(1, all[pos]);
if (N == 1)
return curr;
string rest = "";
for (int i = 0; i < 4; i++)
if (i != pos)
rest += all[i];
for (int i = 1; i < N - 1; i++) {
string q = curr + rest[1];
for (int j = 0; j < 3; j++)
q += curr + rest[0] + rest[j];
curr += rest[i - press(q) + 2];
}
int lst = 2;
for (int i = 0; i < 2; i++)
if (press(curr + rest[i]) == N) {
lst = i;
break;
}
return curr + rest[lst];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |