Submission #1188266

#TimeUsernameProblemLanguageResultExecution timeMemory
1188266alwaus424Combo (IOI18_combo)C++20
10 / 100
15 ms440 KiB
#include <string>
using namespace std;

// You will get this function from the interactive judge
int press(string p);

string guess_sequence(int N) {
    string buttons = "ABXY";
    char first;
    for (char c : buttons) {
        if (press(string(1, c)) == 1) {
            first = c;
            break;
        }
    }

    string answer = string(1, first);
    string rest;
    for (char c : buttons)
        if (c != first) rest += c;

    while (answer.length() < N) {
        for (char c : rest) {
            string trial = answer + c;
            if (press(trial) == trial.length()) {
                answer += c;
                break;
            }
        }
    }

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