# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199206 | joylintp | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
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(ret + c) == 1)
{
ret += c;
break;
}
if (ret.empty())
ret = "Y";
s.erase(ret[0]);
for (int i = 1; i < n; i++)
{
bool suc = false;
for (char c : s)
if (press(ret + c) == (int)ret.size() + 1)
{
ret += c;
suc = true;
}
if (!suc)
ret += *prev(s.end());
}
return ret;
}