# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
958102 | Pring | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
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>
using namespace std;
#include "combo.h"
#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
namespace {
char GET2(string p) {
if (press(p + 'A' + p + 'B') > p.size()) return (press(p + 'A') > p.size() ? 'A' : 'B');
return (press(p + 'X') > p.size() ? 'X' : 'Y');
}
char GET(string p, char disable) {
char a = 'B', b = 'X', c = 'Y';
if (disable == 'B') a = 'A';
if (disable == 'X') b = 'A';
if (disable == 'Y') c = 'A';
int x = press(p + a + a + p + a + b + p + a + c + p + b);
if (x == p.size() + 2) return a;
if (x == p.size() + 1) return b;
return c;
}
}
string guess_sequence(int n) {
string ans = "";
ans.push_back(GET2(ans));
FOR(i, 1, n - 1) ans.push_back(GET(ans, ans[0]));
ans.push_back(GET2(ans));
return ans;
}