제출 #1304931

#제출 시각아이디문제언어결과실행 시간메모리
1304931kaloyan콤보 (IOI18_combo)C++20
0 / 100
1 ms400 KiB
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cassert>

using namespace std;

int press(string p);

string guess_sequence(int N)
{
    string str, res;

    str.resize(4 * N);
    res.resize(N);

    char head;
    for(char symbol : {'A', 'B', 'X', 'Y'})
    {
        std::fill(str.begin(), str.end(), symbol);
        
        if(press(str) == 1)
        {
            head = symbol;
            break;
        }
    }
    
    res.push_back(head);
    for(int i = 1 ; i < N ; ++i)
    {
        for(char symbol : {'A', 'B', 'X', 'Y'})
        {
            str.clear();

            str = res;
            str.push_back(symbol);

            for(int j = i + 1 ; j < 4 * N ; ++j)
            {
                str[j] = head;
            }

            if(press(str) == i + 1)
            {
                res.push_back(symbol);
                break;
            }
        }
    }

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