제출 #823530

#제출 시각아이디문제언어결과실행 시간메모리
823530handlewastaken콤보 (IOI18_combo)C++17
100 / 100
26 ms656 KiB
#include "combo.h"
#include <string>
using namespace std;
string guess_sequence(int n)
{
    string s, t;
    int i, er = press("AB"), se = press("AX");
    if (er > 0)
    {
        if (se > 0)
            t = "ABXY";
        else
            t = "BXYA";
    }
    else
    {
        if (se > 0)
            t = "XYAB";
        else
            t = "YABX";
    }
    s = t[0];
    if (n == 1)
        return s;
    for (i = 2; i < n; i++)
    {
        er = press(s + t[1] + s + t[2] + t[1] + s + t[2] + t[2] + s + t[2] + t[3]);
        if (er == i)
            s += t[1];
        else if (er == i + 1)
            s += t[2];
        else
            s += t[3];
    }
    er = press(s + t[1]);
    se = press(s + t[2]);
    if (er == n)
        s += t[1];
    else if (se == n)
        s += t[2];
    else
        s += t[3];
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...