제출 #1018403

#제출 시각아이디문제언어결과실행 시간메모리
1018403efishel콤보 (IOI18_combo)C++17
100 / 100
26 ms1868 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;

string guess_sequence (int n) {
    string good = "", oths;
    if (press("AB") > 0) {
        if (press("A") > 0) good = "A", oths = "BXY";
        else good = "B", oths = "AXY";
    } else {
        if (press("X") > 0) good = "X", oths = "ABY";
        else good = "Y", oths = "ABX";
    }
    if (n == 1) return good;
    for (ll i = 1; i < n-1; i++) {
        ll ans = press(good+oths[0]+good+oths[1]+oths[0]+good+oths[1]+oths[1]+good+oths[1]+oths[2]);
        if (ans == i) {
            good += oths[2];
        } else if (ans == i+1) {
            good += oths[0];
        } else if (ans == i+2) {
            good += oths[1];
        } else assert(false);
    }
    if (press(good+oths[0]+good+oths[1]) == n) {
        if (press(good+oths[0]) == n) good += oths[0];
        else good += oths[1];
    } else {
        good += oths[2];
    }
    return good;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...