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 <iostream>
#include <vector>
#include "combo.h"
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> bigInt;
const ull INF = -1;
string guess_sequence(int n) {
string ans;
ans.reserve(n);
if (press("AB")) {
if (press("A"))
ans.push_back('A');
else
ans.push_back('B');
}
else {
if (press("X"))
ans.push_back('X');
else
ans.push_back('Y');
}
char ex = ans[0];
string t, letters = "ABXY", tl;
for (char c : letters)
if (c != ex)
tl.push_back(c);
t.reserve(4 * n);
for (int i = 2; i <= n; ++i) {
t = "";
t.reserve(4 * n);
for (int i = 0; i < 3; ++i) {
t += ans;
t.push_back(tl[i]);
}
if (press(t.substr(0, i << 1)) == i) {
if (press(t.substr(0, i)) == i)
ans.push_back(tl[0]);
else
ans.push_back(tl[1]);
}
else {
ans.push_back(tl[2]);
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |