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;
typedef int64_t ll;
typedef string str;
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
string guess_sequence(int N) {
int get = press("AB");
str res, a, b, c;
if (get) {
if (press("A")) res = "A", a = "B", b = "X", c = "Y";
else res = "B", a = "A", b = "X", c = "Y";
} else {
if (press("X")) res = "X", a = "Y", b = "A", c = "B";
else res = "Y", a = "X", b = "A", c = "B";
}
if (N == 1) return res;
for (int i = 2; i < N; i++) {
get = press(res + a + a + res + a + b + res + a + c + res + b);
if (get == i + 1) res += a;
else if (get == i) res += b;
else res += c;
}
if (press(res + a) == N) res += a;
else if (press(res + b) == N) res += b;
else res += c;
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |