| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 401527 | _DaNeK_ | Combo (IOI18_combo) | C++17 | 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 <bits/stdc++.h>
using namespace std;
char m[4] = {'A', 'B', 'Y', 'X'};
int press(string p)
{
    cout << p << "\n";
    int a;
    cin >> a;
    return a;
}
string guess_sequence(int N)
{
    string res = "";
    int cur = 0, i = 0, first = 0;
    while (i < 3 && press(res + m[i]) != cur + 1)
        ++i;
    res += m[i];
    first = i;
    cur = 1;
    while (res.size() < (unsigned int ) N)
    {
        int ind = 0, cnt = 0;
        bool f = true;
        while (cnt < 2 && f)
        {
            if (ind == first) continue ;
            if (press(res + m[ind]) == cur + 1)
                f = false;
            if (f)
            {
                ++cnt;
                ++ind;
            }
        }
        if (ind == first)
            ++ind;
        ++cur;
        res += m[ind];
    }
    return res;
}
