제출 #1350238

#제출 시각아이디문제언어결과실행 시간메모리
1350238bozho콤보 (IOI18_combo)C++20
10 / 100
6 ms428 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int n)
{
    char c[4] = {'B', 'X', 'A', 'Y'};
    int f, l;
    string idk = "";
    for (int i = 0; i < 4; i++)
    {
        idk = "";
        idk += c[i];
        if (press(idk))
        {
            f = i;
            break;
        }
    }
    l = f;
    string s = "", tr = "";
    s += c[f];
    for (int i = 0; i < n; i++)
        tr += 'A';
    tr[0] = c[f];
    int op;
    while (s.size() < n)
    {
        for (int j = 0; j < 4; j++)
        {
            if (j == l || j == f)
                continue;
            for (int i = s.size(); i < n; i++)
                tr[i] = c[j];
            l = j;
            op = press(tr);
            for (int i = s.size(); i < op; i++)
                s += c[l];
            if (op > s.size())
                break;
        }
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...