제출 #1358962

#제출 시각아이디문제언어결과실행 시간메모리
1358962NValchanovCombo (IOI18_combo)C++20
100 / 100
5 ms488 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";
        }
    }

    if(N == 1)
        return ans;

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

        int cur = press(test);

        if(cur == i - 1)
            ans += rest[2];
        else if(cur == i)
            ans += rest[0];
        else if(cur == i + 1)
            ans += rest[1];
        else
            assert(false);
    }

    if(press(ans + rest[0]) == N)
        ans += rest[0];
    else if(press(ans + rest[1]) == N)
        ans += rest[1];
    else
        ans += rest[2];

    return ans;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…