Submission #1114550

#TimeUsernameProblemLanguageResultExecution timeMemory
1114550lftroq콤보 (IOI18_combo)C++14
0 / 100
1 ms336 KiB
#include "combo.h"

using namespace std;

string guess_sequence(int N) {
    string s="";
    if(press("AB"))
    {
        if(press("A")) s.push_back('A');
        else s.push_back('B');
    }
    else
    {
        if(press("X")) s.push_back('X');
        else s.push_back('Y');
    }
    string can="ABXY";
    if(s[0]=='A') can.erase(0,1);
    else if(s[0]=='B') can.erase(1,1);
    else if(s[0]=='X') can.erase(2,1);
    else can.erase(3,1);
    for(int i=1;i<N;i++)
    {
        string t=s;
        t.push_back(can[0]);
        t+=s;
        t.push_back(can[1]);t.push_back(can[0]);
        t+=s;
        t.push_back(can[1]);t.push_back(can[1]);
        t+=s;
        t.push_back(can[1]);t.push_back(can[2]);
        int c=press(t);
        if(c==i) s.push_back(can[2]);
        else if(c==i+1) s.push_back(can[0]);
        else s.push_back(can[1]);
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...