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;
#define dbg(x) cerr << #x << ": " << x << endl;
const char chars[] = {'A', 'B', 'X', 'Y'};
int press(string p);
string guess_sequence(int n) {
char first_char;
if (press("AB")) {
if (press("A")) {
first_char = 'A';
} else {
first_char = 'B';
}
} else {
if (press("X")) {
first_char = 'X';
} else {
first_char = 'Y';
}
}
string good;
for (auto c : chars) {
if (c != first_char) good += c;
}
mt19937 rnd(1337);
string res = string(1, first_char);
for (int i = 1; i < n; ++i) {
string curr = res;
curr.resize(n, first_char);
curr += curr;
curr += curr;
curr[i] = good[0];
curr[i + n] = good[1];
curr[i + 2 * n] = good[2];
if (press(curr.substr(0, 2 * n)) == i + 1) {
if (press(curr.substr(0, n)) == i + 1) {
res += good[0];
} else {
res += good[1];
}
} else {
res += good[2];
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |