Submission #1317014

#TimeUsernameProblemLanguageResultExecution timeMemory
1317014marzuq01Combo (IOI18_combo)C++20
0 / 100
0 ms332 KiB
#include "combo.h"

std::string guess_sequence(int N) {
    std::string ans;
    //std::string s;
    std::string alp = "ABXY";
    int coin;
    coin = press("AB");
    if(coin) {
        coin = press("A");
        if (coin) ans = "A";
        else ans = "B";
    } else {
        coin = press("X");
        if (coin) ans = "X";
        else ans = "Y";
    }
    std::string temp;
    for (auto i: alp) if (i != ans[0]) temp += i;
    //int tindex = 0; //012
    while(ans.size() < N) {
        int now = ans.size();
        std::string s = ans + temp[0] + temp[1] + ans+ temp[0] + temp[2] + ans + temp[0] + temp[0] + ans + temp[1];
        coin = press(s);
        if (coin == now) ans += temp[2];
        else if (coin == now + 1) ans += temp[1];
        else ans += temp[0];
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...