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) {
vector<char> ch = {'A', 'B', 'X', 'Y'};
int x = 0;
string s;
if (press("AB")) x = press("A") != 1;
else x = 2 + (press("X") < 1);
s += ch[x];
ch.erase(ch.begin() + x);
for (int i = 1; i < N - 1; ++i) {
x = press(s + ch[0] + ch[0] + s + ch[0] + ch[1] + s + ch[0] + ch[2] + s + ch[1]);
if (x == i + 2) s += ch[0];
else if (x == i + 1) s += ch[1];
else s += ch[2];
}
if (press(s + ch[0] + s + ch[1]) == N) {
if (press(s + ch[0]) == N) s += ch[0];
else s += ch[1];
} else {
s += ch[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |