Submission #95715

#TimeUsernameProblemLanguageResultExecution timeMemory
95715jeffCombo (IOI18_combo)C++14
100 / 100
115 ms620 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
    int r, i;
    string c, s;
    if (press("AB")) {
        if (press("A")) c = "ABXY";
        else c = "BXYA";
    } else {
        if (press("X")) c = "XYAB";
        else c = "YABX";
    }
    s = c[0];
 	if (N == 1) return s;
    for (i = 1; i < N - 1; ++i) {
        r = press(s + c[1] + c[1] + s + c[1] + c[2] + s + c[1] + c[3] + s + c[2]) - i;
        if (r == 2) s += c[1];
        else if (r == 1) s += c[2];
        else s += c[3];
    }
    if (press(s + "A" + s + "B") == N) {
        if (press(s + "A") == N) s += "A";
        else s += "B";
    } else {
        if (press(s + "X") == N) s += "X";
        else s += "Y";
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...