Submission #1339530

#TimeUsernameProblemLanguageResultExecution timeMemory
1339530chry콤보 (IOI18_combo)C++20
0 / 100
1 ms412 KiB
#include <bits/stdc++.h>
using namespace std;

char choices[4] = {'A', 'B', 'X', 'Y'};

int press(string p);

string guess_sequence(int N) {
    string S = "";
    
    function<bool(int)> dfs = [&](int now) -> bool {
        for (int i = 0; i < 4; i++) {
            int pp = press(choices[i]+S);
            if (pp == N && pp > now) {
                S += choices[i];
                if (dfs(now+1)) return true;
                S.pop_back();
            }
        }
        return false;
    };

    dfs(0);

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