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;
// int press(string p){
// }
string guess_sequence(int n){
string s;
string temp;
int x=press("AB");
string f;
string combi;
string other;
string last;
if(x>=1){
x = press("A");
if(x==1){
f="A";
combi="X";
other="B";
last="Y";
}else{
f="B";
combi="X";
other="A";
last="Y";
}
}else{
x = press("X");
if(x==1){
f="X";
combi="A";
other="B";
last="Y";
}else{
f="Y";
combi="A";
other="B";
last="X";
}
}
s=f;
while((int)s.size()!=n){
int size=(int)s.size();
if(size==n-1){
temp=s+combi+s+other;
x=press(temp);
if(x==size+1){
temp=s+combi;
x=press(temp);
if(x==size+1){
s+=combi;
}else{
s+=other;
}
}else{
s+=last;
}
break;
}
temp=s+combi+combi;
temp+=s+combi+other;
temp+=s+combi+last;
temp+=s+other;
x=press(temp);
if(x==size+2){
s+=combi;
}else{
if(x==size+1){
s+=other;
}else{
s+=last;
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |