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;
string guess_sequence(int N) {
string al = "ABXY";
string ret;
if (press("AB")) {
if (press("A")) ret = "A";
else ret = "B";
} else {
if (press("XY")) ret = "X";
else ret = "Y";
}
string pos;
for (auto c : al) if (c != ret[0]) pos += c;
for (int i = 1; i < N - 1; ++i) {
string q = ret + pos[0];
for (auto c : pos) {
q += ret + pos[1] + c;
}
int a = press(q);
if (a == i) ret += pos[2];
else if (a == i + 1) ret += pos[0];
else ret += pos[1];
}
if (press(ret + pos[0]) == N) ret += pos[0];
else if (press(ret + pos[1]) == N) ret += pos[1];
else ret += pos[2];
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |