This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |