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>
#define CHECK cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7;
const ll inf = 1e18;
const int OO = 1;
const int OOO = 0;
using namespace std;
//#include "combo.h"
int press(string s);
int ask(string s) {
if (OOO) {
cout << "? " << s << endl;
int rtn;
cin >> rtn;
return rtn;
}
return press(s);
}
string guess_sequence(int N) {
string ans;
string opt;
if (ask("AB")) {
if (ask("A")) {
ans = "A";
opt = "BXY";
}
else {
ans = "B";
opt = "AXY";
}
}
else {
if (ask("X")) {
ans = "X";
opt = "BAY";
}
else {
ans = "Y";
opt = "BXA";
}
}
if (N == 1) return ans;
for (int i = 1; i < N - 1; i++) {
int val = ask(
ans + opt[0] + opt[0] +
ans + opt[0] + opt[1] +
ans + opt[0] + opt[2] +
ans + opt[1]
) - i;
ans.push_back(opt[2 - val]);
}
if (ask(ans + 'A' + ans + 'B') == N) {
if (ask(ans + 'A') == N) return ans + 'A';
return ans + 'B';
}
if (ask(ans + 'X') == N) return ans + 'X';
return ans + 'Y';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |