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>
using namespace std;
int press(string p);
string guess_sequence(int N){
int n=N;
string s="";
vector<char> ans(4);
ans[0]='A';
ans[1]='B';
ans[2]='X';
ans[3]='Y';
if(press("AB")>0){
if(press("A")){
s+='A';
ans.erase(ans.begin()+0);
}
else{
s+='B';
ans.erase(ans.begin()+1);
}
}
else{
if(press("X")){
s+='X';
ans.erase(ans.begin()+2);
}
else{
s+='Y';
ans.erase(ans.begin()+3);
}
}
for(int i=1;i<n-1;++i){
string w=s+ans[0]+ans[0]+s+ans[0]+ans[1]+s+ans[0]+ans[1]+s+ans[1];
if(press(w)==i){
w+=ans[2];
}
else if(press(w)==i+1){
s+=ans[1];
}
else{
s+=ans[0];
}
}
if(press(s+ans[0])==n){
s+=ans[0];
}
else if(press(s+ans[1])==n){
s+=ans[1];
}
else{
s+=ans[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |