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 long long ll;
typedef pair<int, int> PII;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pct __builtin_popcount
#define INF 1000000007
std::string guess_sequence(int N) {
string p = "";
if (press("AB")) {
if (press("A")) p = "A";
else p = "B";
} else {
if (press("X")) p = "X";
else p = "Y";
}
if (N == 1) return p;
string s = "";
for (char c : "ABXY")
if (p[0] != c) s += c;
for (int i = 1; i < N-1; i ++) {
int c = press(p+s[0]+s[0] + p+s[0]+s[1] + p+s[0]+s[2] + p+s[1]);
if (c == i+2) p += s[0];
if (c == i+1) p += s[1];
if (c == i) p += s[2];
}
if (press(p+s[0]) == N) p += s[0]; else
if (press(p+s[1]) == N) p += s[1];
else p += s[2];
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |