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>
#include "combo.h"
using namespace std;
using ll = long long;
typedef pair<int, int> pii;
string guess_sequence(int n)
{
string output;
vector <string> letters = { "A", "B", "X", "Y" };
string mark;
if (press("AB") > 0)
{
if (press("A")) mark = "A";
else mark = "B";
} else {
if (press("X")) mark = "X";
else mark = "Y";
}
if (n == 1) return mark;
for (int i = 0; i < 4; i++) {
if (letters[i] == mark) {
letters.erase(letters.begin() + i);
break;
}
}
output += mark;
size_t val;
while (output.size() + 1 < (size_t)n)
{
val = press(output + letters[1] + output + letters[2] + letters[0] + output + letters[2] + letters[1] + output + letters[2] + letters[2]);
output += letters[val - output.size()];
}
if (press(output + letters[0] + output + letters[1]) > (int)output.size())
{
if (press(output + letters[0]) > (int)output.size()) output += letters[0];
else output += letters[1];
} else {
output += letters[2];
}
return output;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |