Submission #1218410

#TimeUsernameProblemLanguageResultExecution timeMemory
1218410tapilyocaCombo (IOI18_combo)C++20
100 / 100
6 ms484 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using str = string;
template<typename T>
using vec = vector<T>;
#define pb push_back

std::string guess_sequence(int N) {
    str s;
    str bleh = "ABXY";
    if(press("AB")) {
        if(press("A")) s = "A";
        else s = "B";
    } else {
        if(press("X")) s = "X";
        else s = "Y";
    }

    if(N == 1) return s;

    if(s == "A") swap(bleh[0],bleh[2]);
    if(s == "B") swap(bleh[1],bleh[2]);
    if(s == "Y") swap(bleh[3],bleh[2]);
    for(int i = 1; i < N-1; i++) {
        ll check = press(s + bleh[0] + s + bleh[1] + bleh[1] + s + bleh[1] + bleh[3] + s + bleh[1] + bleh[0]);
        if(check == i) {
            s += bleh[3];
        }
        if(check == i+1) {
            s += bleh[0];
        }
        if(check == i+2) {
            s += bleh[1];
        }
    }
    cerr << s << endl;

    if(press(s + bleh[0] + s + bleh[1]) == N) {
        if(press(s + bleh[0]) == N) return s + bleh[0];
        return s + bleh[1];
    }
    return s + bleh[3];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...