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 "combo.h"
char let[4] = {'A', 'B', 'X', 'Y'};
std::string ans;
std::string guess_sequence(int n)
{
int letIdx = 3;
for (int i = 0 ; i < 3 ; ++i)
{
ans += let[i];
if (press(ans))
{
letIdx = i;
break;
}
ans.pop_back();
}
if (letIdx == 3) ans += let[3];
std::swap(let[letIdx], let[3]);
for (int i = 2 ; i <= n ; ++i)
{
letIdx = 2;
for (int j = 0 ; j < 2 ; ++j)
{
ans += let[j];
if (press(ans) == i)
{
letIdx = j;
break;
}
ans.pop_back();
}
if (letIdx == 2) ans += let[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |