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 <bits/stdc++.h>
#include "combo.h"
std::string guess_sequence(int n) {
std::string osnova,res,q;
q.resize(4*n+5);
if(press("AB")){
if(press("A"))
osnova="A";
else
osnova="B";
}else{
if(press("X"))
osnova="X";
else
osnova="Y";
}
int brojac=0;
std::string kul[5];
if(osnova!="A")
kul[brojac++]="A";
if(osnova!="B")
kul[brojac++]="B";
if(osnova!="X")
kul[brojac++]="X";
if(osnova!="Y")
kul[brojac++]="Y";
for(int i=1;i<n-1;i++){
int t=press(osnova+kul[0]+kul[0]+
osnova+kul[0]+kul[1]+
osnova+kul[0]+kul[2]+
osnova+kul[1]);
if(t==i+2)osnova+=kul[0];
else if(t==i+1)osnova+=kul[1];
else osnova+=kul[2];
}
if(press(osnova+kul[0])==n)return osnova+kul[0];
else if(press(osnova+kul[1])==n)return osnova+kul[1];
else return osnova+kul[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |