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>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
string guess_sequence(int N)
{
string result;
if (press("AB") >= 1)
{
result = (press("A") == 1 ? "A" : "B");
}
else
result = (press("X") == 1 ? "X" : "Y");
if (N == 1)
return result;
vector<string> others = { "A", "B", "X", "Y" };
for (int i = 0; i < 4; i++)
if (others[i] == result)
{
others.erase(others.begin() + i);
break;
}
string check;
int size_cnt;
for (int i = 1; i < N - 1; i++)
{
check = result + others[0] + result + others[1] + others[0] + result + others[1] + others[1] + result + others[1] + others[2];
size_cnt = press(check);
if (size_cnt == i)
result += others[2];
else if (size_cnt == i + 1)
result += others[0];
else
result += others[1];
}
if (press(result + others[0] + result + others[1]) == N)
{
result += (press(result + others[0]) == N ? others[0] : others[1]);
}
else
result += others[2];
return result;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |