# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745638 | borisAngelov | Combo (IOI18_combo) | C++17 | 35 ms | 632 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 <iostream>
#include <string>
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
string s = "";
string p = "XY";
char a, b, c;
if (press(p) > 0)
{
p = "X";
if (press(p) == 1)
{
s = "X";
a = 'A';
b = 'B';
c = 'Y';
}
else
{
s = "Y";
a = 'A';
b = 'B';
c = 'X';
}
}
else
{
p = "A";
if (press(p) == 1)
{
s = "A";
a = 'B';
b = 'X';
c = 'Y';
}
else
{
s = "B";
a = 'A';
b = 'X';
c = 'Y';
}
}
for (int i = 2; i < n; ++i)
{
p = s + a + s + b + a + s + b + b + s + b + c;
int k = press(p);
if (k == s.size())
{
s += c;
}
else if (k == s.size() + 1)
{
s += a;
}
else
{
s += b;
}
}
if (s.size() != n)
{
p = s + a;
if (press(p) == n)
{
s += a;
return s;
}
p = s + b;
if (press(p) == n)
{
s += b;
return s;
}
s += c;
return s;
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |