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;
string guess_sequence(int n)
{
string ret;
set<char> but = {'A', 'B', 'X', 'Y'};
auto pos = but.begin();
for (int j = 0; j < 3; j++, pos++)
if (press(ret + *pos) == 1)
{
ret += *pos;
break;
}
if (ret.empty())
ret = "Y";
but.erase(ret[0]);
for (int i = 1; i < n; i++)
{
bool suc = false;
pos = but.begin();
for (int j = 0; j < 2 && !suc; j++, pos++)
if (press(ret + *pos) == (int)ret.size() + 1)
{
ret += *pos;
suc = true;
}
if (!suc)
ret += *prev(but.end());
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |