Submission #1262879

#TimeUsernameProblemLanguageResultExecution timeMemory
1262879BlockOGCombo (IOI18_combo)C++20
100 / 100
7 ms508 KiB
#include <bits/stdc++.h>

// mrrrow meeow :3
// go play vivid/stasis now! it's free on steam

#define fo(i, a, b) for (auto i = (a); i < (b); i++)
#define of(i, a, b) for (auto i = (b); i-- > (a);)
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define be(a) a.begin(), a.end()
using namespace std;

int ____init = [] {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    return 0;
}();

int press(string p);

string guess_sequence(int n) {
    char cs[4] = {'A', 'B', 'X', 'Y'};
    if (press("AB")) {
        if (press("A")) {
            swap(cs[3], cs[0]);
        } else {
            swap(cs[3], cs[1]);
        }
    } else {
        if (press("X")) {
            swap(cs[3], cs[2]);
        } else {
            swap(cs[3], cs[3]);
        }
    }

    string res;
    res += cs[3];
    if (n == 1) return res;
    fo(i, 1, n - 1) {
        res += cs[press(res + cs[1] + res + cs[2] + cs[0] + res + cs[2] + cs[1] + res + cs[2] + cs[2]) - res.size()];
    }

    if (press(res + cs[0]) - res.size()) {
        res += cs[0];
    } else if (press(res + cs[1]) - res.size()) {
        res += cs[1];
    } else {
        res += cs[2];
    }

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