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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string s = "";
vector<char> v = {'A', 'B', 'X', 'Y'};
int x = press("AB");
if (x) {
if (press("A")) {s += 'A'; v.erase(v.begin());}
else {s += 'B'; v.erase(v.begin() + 1);}
} else {
if (press("X")) {s += 'X'; v.erase(v.begin() + 2);}
else {s += 'Y'; v.erase(v.begin() + 3);}
}
for (int i = 1; i < N - 1; ++i) {
x = press(s + v[0] + v[0] + s + v[0] + v[1] + s + v[0] + v[2] + s + v[1]);
if (x == i + 2) s += v[0];
if (x == i + 1) s += v[1];
else s += v[2];
}
if (press(s + v[0] + s + v[1]) == N) {
if (press(s + v[0]) == N) s += v[0];
else s += v[1];
} else s += v[2];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |