Submission #199207

#TimeUsernameProblemLanguageResultExecution timeMemory
199207joylintpCombo (IOI18_combo)C++17
0 / 100
62 ms312 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence(int n)
{
    string ans;
    set<char> s = {'A', 'B', 'X', 'Y'};

    for (char c : s)
        if (press(ans + c) == 1)
        {
            ans += c;
            break;
        }
    if (ans.empty())
        ans = "Y";
    s.erase(ans[0]);

    for (int i = 1; i < n; i++)
    {
        bool suc = false;
        for (char c : s)
            if (press(ans + c) == (int)ans.size() + 1)
            {
                ans += c;
                suc = true;
            }
        if (!suc)
            ans += *prev(s.end());
    }

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