Submission #1187386

#TimeUsernameProblemLanguageResultExecution timeMemory
1187386nagorn_phCombo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence(int n) {
    string s = "";
    string can = "";
    int op = 0;
    if (press("AB")) {
        if (press("A")) {
            can = "BXY";
            s += 'A';
        }
        else {
            can = "AXY";
            s += 'B';
        }
    }
    else {
        if (press("X")) {
            can = "ABY";
            s += 'X';
        }
        else {
            can = "ABX";
            s += 'Y';
        }
    }
    while (s.length() < n - 1) {
        string curr = s + can[0] + s + can[1] + can[0] + s + can[1] + can[1] + s + can[1] + can[2];
        op = press(curr);
        if (op == s.length()) s += can[2];
        else if (op == s.length() + 1) s += can[0];
        else if (op == s.length() + 2) s += can[1];
    }
    if (press(s + can[0])) s += can[0];
    else if (press(s + can[1])) s += can[1];
    else s += can[2];
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...