# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961171 | raspy | Combo (IOI18_combo) | C++14 | 15 ms | 1956 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 <iostream>
using namespace std;
string guess_sequence(int n)
{
char a[5] = {'A', 'B', 'X', 'Y'};
string p = "A";
string s = "";
{
p = "AB";
int odg = press(p);
if (odg)
{
p = "A";
if (press(p))
{
s = "A";
swap(a[0], a[3]);
}
else
{
s = "B";
swap(a[1], a[3]);
}
}
else
{
p = "X";
if (press(p))
{
s = "X";
swap(a[2], a[3]);
}
else
s = "Y";
}
}
for (int tr = 2; tr < n; tr++)
{
p = "";
p = s + a[0];
p = p + s+a[1]+a[0];
p = p + s+a[1]+a[2];
p = p + s+a[1]+a[1];
// cout << p << " " << p.size() << "\n";
int odg = press(p);
if (odg == tr)
s += a[0];
else if (odg == tr+1)
s += a[1];
else if (odg == tr-1)
s += a[2];
}
p = "";
if (s.size() < n)
{
p = s+a[0];
int odg = press(p);
if (odg == n)
return p;
p = s+a[1];
odg = press(p);
if (odg == n)
return p;
p = s+a[2];
return p;
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |