This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
using namespace std;
#include "combo.h"
char c[] = {'A', 'B', 'X', 'Y'};
char s[3];
string ret;
string guess_sequence(int N) {
if (press("AB")) {
if (press("A")) ret = "A";
else ret = "B";
}
else {
if (press("X")) ret = "X";
else ret = "Y";
}
int j = 0;
for (int i = 0; i < 4; i++) {
if (c[i] == ret[0]) continue;
s[j] = c[i];
j++;
}
for (int i = 0; i < N - 2; i++) {
ret += s[press(ret + s[2] + s[0] + ret + s[2] + s[1] + ret + s[2] + s[2] + ret + s[1]) - ret.size()];
}
if (press(ret + s[0]) == N) return (ret + s[0]);
if (press(ret + s[1]) == N) return (ret + s[1]);
return (ret + s[2]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |