Submission #1211332

#TimeUsernameProblemLanguageResultExecution timeMemory
1211332lukasuliashviliCombo (IOI18_combo)C++20
10 / 100
15 ms456 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
    string all = "ABXY";
    string p = "";

    // Step 1: find the first character
    for (char c : all) {
        if (press(string(1, c)) == 1) {
            p += c;
            break;
        }
    }

    // Step 2: find the rest
    for (int i = 1; i < N; ++i) {
        for (char c : all) {
            if (c == p[0]) continue; // skip already used first char
            string tryStr = p + c;
            if (press(tryStr) == i + 1) {
                p += c;
                break;
            }
        }
    }

    return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...