Submission #1358951

#TimeUsernameProblemLanguageResultExecution timeMemory
1358951NValchanovCombo (IOI18_combo)C++20
30 / 100
9 ms532 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 2e3 + 10;

string guess_sequence(int N) 
{
    string ans = "";

    string rest = "";

    if(press("AX") >= 1)
    {
        if(press("A"))
        {
            ans = "A";
            rest = "BXY";
        }
        else 
        {
            ans = "X";
            rest = "ABY";
        }
    }
    else 
    {
        if(press("B"))
        {
            ans = "B";
            rest = "AXY";
        }
        else
        {
            ans = "Y";
            rest = "ABX";
        }
    }

    for(int i = 2; i <= N; i++)
    {
        string test1 = ans + rest[0] + ans + rest[1];
        string test2 = ans + rest[0] + ans + rest[2];

        int t1 = press(test1);
        int t2 = press(test2);

        bool c1 = !(t1 == i);
        bool c2 = !(t2 == i);

        int cur = c1 * 2 + c2;

        ans = ans + rest[cur];
    }

    return ans;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...