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"
using namespace std;
string guess_sequence(int n)
{
string letters = "ABXY", start, curr, trial;
for (char x : letters)
{
start = x;
if (press(start) == 1)
{
break;
}
}
curr = start;
while ((int)curr.size() < n)
{
bool found_next_char = false;
for (char x : letters)
{
if (x == start[0])
continue;
trial = curr + x;
int res = press(trial);
if (res > (int)curr.size())
{
curr += x;
found_next_char = true;
break;
}
}
if (!found_next_char)
break;
}
return curr;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |