# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
226621 | AaronNaidu | Combo (IOI18_combo) | C++14 | 40 ms | 648 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 toRet;
if (n == 1)
{
if (press("A"))
{
return "A";
}
if (press("B"))
{
return "B";
}
if (press("X"))
{
return "X";
}
return "Y";
}
if (press("AB"))
{
if (press("A"))
{
toRet = "A";
for (int i = 1; i < n-1; i++)
{
int x = press(toRet + "B" + toRet + "XB" + toRet + "XY" + toRet + "XX");
if (x == i)
{
toRet = toRet + "Y";
}
else if (x == i + 1)
{
toRet = toRet + "B";
}
else
{
toRet = toRet + "X";
}
}
if (press(toRet + "B") == n)
{
return toRet + "B";
}
if (press(toRet + "X") == n)
{
return toRet + "X";
}
return toRet + "Y";
}
else
{
toRet = "B";
for (int i = 1; i < n-1; i++)
{
int x = press(toRet + "A" + toRet + "XA" + toRet + "XY" + toRet + "XX");
if (x == i)
{
toRet = toRet + "Y";
}
else if (x == i + 1)
{
toRet = toRet + "A";
}
else
{
toRet = toRet + "X";
}
}
if (press(toRet + "A") == n)
{
return toRet + "A";
}
if (press(toRet + "X") == n)
{
return toRet + "X";
}
return toRet + "Y";
}
}
else
{
if (press("X"))
{
toRet = "X";
for (int i = 1; i < n-1; i++)
{
int x = press(toRet + "B" + toRet + "AB" + toRet + "AY" + toRet + "AA");
if (x == i)
{
toRet = toRet + "Y";
}
else if (x == i + 1)
{
toRet = toRet + "B";
}
else
{
toRet = toRet + "A";
}
}
if (press(toRet + "B") == n)
{
return toRet + "B";
}
if (press(toRet + "A") == n)
{
return toRet + "A";
}
return toRet + "Y";
}
else
{
toRet = "Y";
for (int i = 1; i < n-1; i++)
{
int x = press(toRet + "B" + toRet + "XB" + toRet + "XA" + toRet + "XX");
if (x == i)
{
toRet = toRet + "A";
}
else if (x == i + 1)
{
toRet = toRet + "B";
}
else
{
toRet = toRet + "X";
}
}
if (press(toRet + "B") == n)
{
return toRet + "B";
}
if (press(toRet + "X") == n)
{
return toRet + "X";
}
return toRet + "A";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |