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){
char sep ;
if(press("AB")!=0){
if(press("A")) sep='A' ;
else sep = 'B' ;
}
else{
if(press("X")) sep='X' ;
else sep='Y' ;
}
string ans ;
ans+=sep ;
vector<char> B = {'A','B','X','Y'} ;
for(int i=0;i<4;i++){
if(B[i]==sep){
B.erase(B.begin()+i) ;
break ;
}
}
for(int len=2;len<n;len++){
string ask = ans ;
ask+=B[0] ;
for(char x : B){
ask+=ans;
ask+=B[1];
ask+=x;
}
int res = press(ask) ;
if(res==len){
ans+=B[0] ;
}
else if(res!=len-1){
ans+=B[1] ;
}
else{
ans+=B[2] ;
}
}
string ask = ans ;
ask+=B[0] ;
ask+=ans ;
ask+=B[1] ;
int res = press(ask) ;
if(res==n){
ask=ans+B[0] ;
res = press(ask);
if(res==n) ans+=B[0];
else ans+=B[1];
}
else ans+=B[2];
return ans ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |