# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132116 | Tuk1352 | Combo (IOI18_combo) | C++11 | 50 ms | 784 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)
{
int r;
string s1, s2, s3, s4, s, S;
map <int, char> Ma;
Ma[0] = 'A';
Ma[1] = 'B';
Ma[2] = 'X';
Ma[3] = 'Y';
s = "AB";
r = press(s);
if (r >= 1)
{
s = "A";
r = press(s);
if (r == 0)
{
Ma[1] = 'A';
Ma[0] = 'B';
S = "B";
}
else
{
S = "A";
}
}
else
{
s = "X";
r = press(s);
if (r == 1)
{
Ma[0] = 'X';
Ma[2] = 'A';
S = "X";
}
else
{
Ma[0] = 'Y';
Ma[3] = 'A';
S = "Y";
}
}
for (int i = 1; i < N-1; i++)
{
s1 = S + Ma[1];
s2 = S + Ma[2] + Ma[1];
s3 = S + Ma[2] + Ma[2];
s4 = S + Ma[2] + Ma[3];
s = s1 + s2 + s3 + s4;
r = press(s);
if (r == S.length())
{
S += Ma[3];
}
else if (r == S.length() + 1)
{
S += Ma[1];
}
else
{
S += Ma[2];
}
}
if (N >= 2)
{
s = S + Ma[1];
r = press(s);
if (r == N)
{
S += Ma[1];
return S;
}
s = S + Ma[2];
r = press(s);
if (r == N)
{
S += Ma[2];
return S;
}
S += Ma[3];
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |