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"
using namespace std;
string guess_sequence(int N){
string solved_string;
int xy = press("XY");
if (xy==1){
if (press("X") == 1){
solved_string = "X";
}
else solved_string = "Y";
}
else{
if (press("A") == 1){
solved_string = "A";
}
else solved_string = "B";
}
char valids[3];
int ct=0;
if (solved_string!="A"){ valids[ct] = 'A'; ct++;}
if (solved_string!="B"){ valids[ct] = 'B'; ct++;}
if (solved_string!="X"){ valids[ct] = 'X'; ct++;}
if (solved_string!="Y"){ valids[ct] = 'Y'; ct++;}
for (int i=1; i<N-1; i++){
string newnew = solved_string + valids[0] + valids[1] + solved_string + valids[0] + valids[2] + solved_string + valids[0] + valids[0] + solved_string + valids[1];
int p = press(newnew);
if (p==i+2) solved_string+=valids[0];
else if (p==i+1) solved_string+=valids[1];
else solved_string+=valids[2];
}
if (press(solved_string+valids[0]) == N) return solved_string+valids[0];
if (press(solved_string+valids[1]) == N) return solved_string+valids[1];
else return solved_string+valids[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |