# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
220619 | Coroian_David | Combo (IOI18_combo) | C++11 | 0 ms | 0 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"
std::string guess_sequence(int N) {
using namespace std;
string s;
s.clear();
char ch[4] = {'A', 'B', 'X', 'Y'};
int poz = 0;
int x = press("AB");
cout << "INTREB AB REZ = " << x << "\n";
if(x >= 1)
{
int y = press("A");
poz = (y == 1 ? 0 : 1);
}
else
{
int y = press("X");
poz = (y == 1 ? 2 : 3);
}
swap(ch[0], ch[poz]);
s.resize(1);
s[0] = ch[0];
string a;
a.clear();
for(int i = 1; i < N - 1; i ++)
{
a = s + ch[2] +
s + ch[3] + ch[1] +
s + ch[3] + ch[2] +
s + ch[3] + ch[3];
int x = press(a) - i;
s.resize(i + 1);
s[i] = ch[1 + x];
}
x = press(s + ch[1] + s + ch[2]);
if(x == N)
{
int y = press(s + ch[1]);
s.resize(N);
s[N - 1] = (y == N ? ch[1] : ch[2]);
}
else
{
s.resize(N);
s[N - 1] = ch[3];
}
return s;
}