Submission #128132

#TimeUsernameProblemLanguageResultExecution timeMemory
128132WannnabeIOICombo (IOI18_combo)C++14
100 / 100
42 ms596 KiB
#include "combo.h"
#include <vector>
using namespace std; 
int head,len=1;
void start();
void end(int N);
string c="ABXY",S,id;
vector<std::string>h[4]; 
string generate_press(){
    return S+id[0]+S+id[1]+id[0]+
    S+id[1]+id[1]+S+id[1]+id[2]; 
}
string guess_sequence(int N){
    start();
    while(len<N-1){
        int opt=press(generate_press())-len;
        S+=id[(opt+2)%3];
      	++len;
    }
    if (len==N-1) end(N);
    return S;
}
void start(){
    S=id="";
    if (press("AB")){
        if (press("A")) S+=c[head=0]; //A
        else S+=c[head=1]; //B
    }
    else{
        if (press("X")) S+=c[head=2]; //X
        else S+=c[head=3]; //Y
    }
    for (int i=0;i<4;++i)
        if (i!=head) id+=c[i];
}
void end(int N){
    if (press((S+id[0]+S+id[1]))==N){
        if (press((S+id[0]))==N) S+=id[0];
        else S+=id[1];
    }
    else S+=id[2];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...