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;
using ll = long long;
using vll = vector <ll>;
string guess_sequence (int n) {
string good = "", oths;
if (press("AB") > 0) {
if (press("A") > 0) good = "A", oths = "BXY";
else good = "B", oths = "AXY";
} else {
if (press("X") > 0) good = "X", oths = "ABY";
else good = "Y", oths = "ABX";
}
if (n == 1) return good;
for (ll i = 1; i < n-1; i++) {
ll ans = press(good+oths[0]+good+oths[1]+oths[0]+good+oths[1]+oths[1]+good+oths[1]+oths[2]);
if (ans == i) {
good += oths[2];
} else if (ans == i+1) {
good += oths[0];
} else if (ans == i+2) {
good += oths[1];
} else assert(false);
}
if (press(good+oths[0]+good+oths[1]) == n) {
if (press(good+oths[0]) == n) good += oths[0];
else good += oths[1];
} else {
good += oths[2];
}
return good;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |