# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167128 | minseo852 | Combo (IOI18_combo) | C++11 | 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 <combo.h>
#include<string>
#include <vector>
using namespace std;
string guess_sequence(int N)
{
std::string r, p, o = "ABXY";
int i, j, c;
int a = 0, b = 0, d = 0;
r = t("AB") ? t("A") ? "A" : "B" : t("X") ? "X" : "Y";
for (i = 0; i < 4; i++)if (o[i] == r[0]){ o.erase(o.begin() + i); break; }
for (int i = 1; i < N - 1; i++)
{
p = r + o[0] + r + o[1] + o[0] + r + o[1] + o[1] + r + o[1] + o[2];
c = press(p);
if (c == i)
r += o[2];
else if (c == i + 1)
r += o[0];
else
r += o[1];
}
if (press(r + o[0] + r + o[1]) == N)
{
r += (press(r + o[0]) == N ? o[0] : o[1]);
}
else
r += o[2];
return r;
}