제출 #1148874

#제출 시각아이디문제언어결과실행 시간메모리
1148874andrejikus콤보 (IOI18_combo)C++20
30 / 100
11 ms476 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)

const int N = 2e5 + 3;
char ELEM[4] = {'A', 'B', 'X', 'Y'};

string guess_sequence(int n) {

    string s = "";
    string p = string(1, ELEM[0]) + string(1, ELEM[1]);
    if (press(p) > 0) {
        string c = string(1, ELEM[0]);
        if (press(c))
            s += c;
        else
            s += string(1, ELEM[1]);
    } else {
        string c = string(1, ELEM[2]);
        if (press(c))
            s += c;
        else
            s += string(1, ELEM[3]);
    }
    /// 3 qry

    for (int i = 2; i <= n; i++) {
        vector<char> vec;
        for (int d = 0; d < 4; d++)
            if (s[0] != ELEM[d])
                vec.push_back(ELEM[d]);
        string p = s + vec[0] + s + vec[1];
        if (press(p) == i) {
            string c = s + vec[0];
            if (press(c) == i)
                s += vec[0];
            else
                s += vec[1];
        } else {
            s += vec[2];
        }
    }

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