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 <string>
#include <iostream>
using namespace std;
std::string guess_sequence(int N) {
string c="";
string test="";
char l[]={'A','B','X','Y'},arr[3];
if (press("AB")>0){
if (press("A")==1) c="A";
else c="B";
}
else{
if (press("X")==1)c="X";
else c="Y";
}
if (N==1) return c;
int y=-1;
for (int x=0;x<3;x++){
y++;
if (c[0]==l[y]){
x--;
continue;
}
arr[x]=l[y];
}
N--;
for (int x=1;x<N;x++){
test=c+arr[1]+c+arr[2]+arr[0]+c+arr[2]+arr[1]+c+arr[2]+arr[2];
y=press(test)-x;
c+=arr[y];
}
N++;
if (press(c+"A"+c+"B")==N){
if (press(c+"A")==N) c+="A";
else c+="B";
}
else{
if (press(c+"X")==N)c+="X";
else c+="Y";
}
return c;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |