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 f;
char s[3];
string guess_sequence(int N) {
string ret = "";
int t = press("AB");
if (t > 0) {
int tmp = press("A");
if (tmp > 0) f = 'A';
else f = 'B';
}
else {
int tmp = press("X");
if (tmp > 0) f = 'X';
else f = 'Y';
}
ret += f;
if (N == 1) return ret;
int j = 0;
for (int i = 0; i < 4; i++) {
if (c[i] == f) continue;
s[j] = c[i];
j++;
}
for (int i = 0; i < N - 2; i++) {
t = press(ret + s[2] + s[0] + ret + s[2] + s[1] + ret + s[2] + s[2] + ret + s[1]);
ret += s[t - ret.size()];
}
t = press(ret + s[0]);
if (t == N) return (ret + s[0]);
t = press(ret + s[1]);
if (t == 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... |