Submission #551598

#TimeUsernameProblemLanguageResultExecution timeMemory
551598PunnyBunnyCombo (IOI18_combo)C++17
100 / 100
30 ms660 KiB
#include "combo.h"

#include <bits/stdc++.h>
std::string guess_sequence(int n) {
    using namespace std;
    string x, s;
    int a = press("AB");
    if (a >= 1) {
        a = press("A");
        if (a) x = "BXY", s = "A";
        else x = "AXY", s = "B";
    } else {
        if (press("X")) x = "ABY", s = "X";
        else x = "ABX", s = "Y";
    }

    for (int i = 1; i < n - 1; ++i) {
        a = press(s + x[0] + s + x[1] + x[0] + s + x[1] + x[1] + s + x[1] + x[2]);
        if (a == 0 + i) s += x[2];
        if (a == 1 + i) s += x[0];
        if (a == 2 + i) s += x[1];
    }
    if (n > 1) {
        a = press(s + x[0]);
        if (a == n) s += x[0];
        else {
            a = press(s + x[1]);
            if (a == n) s += x[1];
            else s += x[2];
        }
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...