# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988902 | lo0ker | Combo (IOI18_combo) | C++17 | 19 ms | 2128 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 <bits/stdc++.h>
using namespace std;
string guess_sequence(int n)
{
if (n == 1)
{
if (press("A") == 1)
return "A";
if (press("B") == 1)
return "B";
if (press("X") == 1)
return "X";
return "Y";
}
string s;
int k = press("AB");
if (k > 0)
{
if (press("A") == 1)
s = "A";
else
s = "B";
}
else
{
if (press("X") == 1)
s = "X";
else
s = "Y";
}
string c = "ABXY";
c.erase(find(c.begin(), c.end(), s[0]));
while (s.size() < n - 1)
{
string q = s + c[1] + s + c[2] + c[0] + s + c[2] + c[1] + s + c[2] + c[2];
s += c[press(q) - s.size()];
}
if (press(s + c[0]) == n)
s += c[0];
else if (press(s + c[1]) == n)
s += c[1];
else
s += c[2];
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |