# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
401584 | _DaNeK_ | Combo (IOI18_combo) | C++17 | 69 ms | 584 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>
using namespace std;
vector < char > m = {'A', 'B', 'Y', 'X'};
int press(string p);
string guess_sequence(int N)
{
string res = "";
int tmp = press("AB");
if (tmp > 0)
{
if (press("A"))
{
res = "A";
m.erase(m.begin());
}
else
{
res = "B";
m.erase(m.begin() + 1);
}
}
else
{
if (press("X"))
{
res = "X";
m.erase(m.begin() + 3);
}
else
{
res = "Y";
m.erase(m.begin() + 2);
}
}
if (N == 1)
return res;
int cur = 2;
while (res.size() < N - 1)
{
string s = res + m[0] + res + m[1] + m[0] + res + m[1] + m[1] + res + m[1] + m[2];
int tmp = press(s);
if (tmp == cur - 1)
res += m[2];
else
{
if (tmp == cur)
res += m[0];
else
res += m[1];
}
++cur;
}
if (press(res + m[0]) == cur)
res += m[0];
else if (press(res + m[1]) == cur)
res += m[1];
else
res += m[2];
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |