Submission #1314474

#TimeUsernameProblemLanguageResultExecution timeMemory
1314474eldorbek_008Combo (IOI18_combo)C++17
0 / 100
0 ms332 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int n) {
    string s = "";
    int c1 = press("AB");
    int c2;
    if (c1 > 0) {
        c2 = press("A");
        if (c2 > 0) {
            s = "A";
        } else {
            s = "B";
        }
    } else {
        c2 = press("X");
        if (c2 > 0) {
            s = "X";
        } else {
            s = "Y";
        }
    }
    string p = s;
    string t = "ABXY";
    t.erase(t.find(p[0]));
    for (int i = 1; i <= n; i++) {
        string cur = s + t[0] + t[0] + s + t[0] + t[1] + s + t[0] + t[2] + s + t[1] + p;
        int c = press(cur);
        if (c == 0) {
            s += t[0];
        } else if (c == 1) {
            s += t[1];
        } else {
            s += t[2];
        }
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...