제출 #1334372

#제출 시각아이디문제언어결과실행 시간메모리
1334372iamhereforfun콤보 (IOI18_combo)C++20
5 / 100
0 ms412 KiB
// Starcraft 2 enjoyer //

#include <bits/stdc++.h>
#include "combo.h"

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

using namespace std;

#define LSOne(X) ((X) & -(X))

const int N = 1e5 + 5;
const int M = 1e6 + 5;
const int LG = 60;
const int INF = 1e9 + 5;
const int K = 301;
const int B = 150000;
const int MOD = 1e9 + 7;
const char type[4] = {'A', 'B', 'X', 'Y'};

string guess_sequence(int n)
{
    string cur = "";
    vector<int> gud;
    for (int x = 0; x < 4; x++)
    {
        cur += type[x];
        int i = press(cur);
        if (i == 1)
        {
            break;
        }
        cur = "";
    }
    for (int x = 0; x < 4; x++)
    {
        if (type[x] == cur[0])
            continue;
        gud.push_back(x);
    }
    for (int x = 1; x < n - 1; x++)
    {
        string add = "";
        for (int i : gud)
        {
            add += cur + type[gud[0]] + type[i];
        }
        add += cur + type[gud[1]];
        int i = press(add);
        if (i == x + 2)
        {
            cur += type[gud[0]];
        }
        else if (i == x + 1)
        {
            cur += type[gud[1]];
        }
        else
        {
            cur += type[gud[2]];
        }
    }
    cur += type[gud[0]];
    int i = press(cur);
    if (i == n)
    {
        return cur;
    }
    cur.pop_back();
    cur += type[gud[1]];
    i = press(cur);
    if (i == n)
    {
        return cur;
    }
    cur.pop_back();
    cur += type[gud[2]];
    return cur;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...