Submission #82730

#TimeUsernameProblemLanguageResultExecution timeMemory
82730314rateCombo (IOI18_combo)C++14
5 / 100
1 ms264 KiB
#include <combo.h>

using namespace std;

string guess_sequence(int n)
{
    string sl;
    string ch;
    if(press("AB")!=0)
    {
        if(press("A")!=0)
        {
            ch="BXY";
            sl="A";
        }
        else
        {
            ch="AXY";
            sl="B";
        }
    }
    else
    {
        if(press("X")!=0)
        {
            ch="ABY";
            sl="X";
        }
        else
        {
            ch="ABX";
            sl="Y";
        }
    }
    for(int now=1;now+1<n;now++)
    {
        string q=(sl+ch[2]+ch[0])+(sl+ch[2]+ch[1])+(sl+ch[2]+ch[2])+(sl+ch[1]);
        int value=press(q);
        sl+=ch[value-now];
    }
    if(press(sl+ch[0])==n)
    {
        sl+=ch[0];
    }
    else
    {
        if(press(sl+ch[1])==n)
        {
            sl+=ch[1];
        }
        else
        {
            sl+=ch[2];
        }
    }
    return sl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...