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;
#define all(x) x.begin(),x.end()
#define endl "\n"
string guess_sequence(int n) {
string ans;
ans.assign(n, 0);
char f;
if (press("AB"))
if (press("A")) f = 'A';
else f = 'B';
else
if (press("X")) f = 'X';
else f = 'Y';
vector<char> r;
for (char c : "ABXY") if (c and c != f)
r.push_back(c);
ans[0] = f;
if (n == 1) return ans;
for (int i = 1; i < n-1; i++) {
string q;
for (char c : r)
q.insert(q.end(), ans.begin(), ans.begin()+i), q.push_back(r[2]), q.push_back(c);
q.insert(q.end(), ans.begin(), ans.begin()+i), q.push_back(r[1]);
/*for (char c : q)
cout << (int) c << " ";
cout << endl;*/
ans[i] = r[press(q)-i];
}
ans.pop_back();
if (press(ans + "A" + ans + "B") == n)
if (press(ans + "A") == n) f = 'A';
else f = 'B';
else
if (press(ans + "X") == n) f = 'X';
else f = 'Y';
ans.push_back(f);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |