제출 #604812

#제출 시각아이디문제언어결과실행 시간메모리
604812boris_mihov콤보 (IOI18_combo)C++14
30 / 100
39 ms564 KiB
#include <iostream>
#include "combo.h"

char let[4] = {'A', 'B', 'X', 'Y'};
std::string ans;
std::string guess_sequence(int n) 
{
    int letIdx = 3;
    for (int i = 0 ; i < 3 ; ++i)
    {
        ans += let[i];
        if (press(ans))
        {
            letIdx = i;
            break;
        }

        ans.pop_back();
    }

    if (letIdx == 3) ans += let[3];
    std::swap(let[letIdx], let[3]);
    for (int i = 2 ; i <= n ; ++i)
    {
        letIdx = 2;
        for (int j = 0 ; j < 2 ; ++j)
        {
            ans += let[j];
            if (press(ans) == i)
            {
                letIdx = j;
                break;
            }

            ans.pop_back();
        }

        if (letIdx == 2) ans += let[2];
    }

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