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 ans;
set<char> s = {'A', 'B', 'X', 'Y'};
for (char c : s)
if (press(ans + c) == 1)
{
ans += c;
break;
}
if (ans.empty())
ans = "Y";
s.erase(ans[0]);
for (int i = 1; i < n; i++)
{
bool suc = false;
for (char c : s)
if (press(ans + c) == (int)ans.size() + 1)
{
ans += c;
suc = true;
}
if (!suc)
ans += *prev(s.end());
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |