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="";
string l1="";
l1+='A';
string l2="";
string l3="";
l2+='B';
l3+='X';
char c;
if(press(l1)==1){
s+=l1;
c='A';
}
else if(press(l2)==1){
s+=l2;
c='B';
}
else if(press(l3)==1){
s+=l3;
c='X';
}
else{
s+='Y';
c='Y';
}
for(int i=1;i<n;++i){
if(c=='A'){
string vec=s+'B'+s+'B'+s+'X';
int kal=press(vec);
kal-=i;
if(kal==0){
s+='Y';
}
if(kal==1){
s+='X';
}
if(kal==2){
s+='B';
s+='B';
}
}
if(c=='B'){
string vec=s+'A'+s+'A'+s+'X';
int kal=press(vec);
kal-=i;
if(kal==0){
s+='Y';
}
if(kal==1){
s+='X';
}
if(kal==2){
s+='A';
}
}
if(c=='X'){
string vec=s+'A'+s+'A'+s+'B';
int kal=press(vec);
kal-=i;
if(kal==0){
s+='Y';
}
if(kal==1){
s+='B';
}
if(kal==2){
s+='A';
}
}
if(c=='Y'){
string vec=s+'A'+s+'A'+s+'B';
int kal=press(vec);
kal-=i;
if(kal==0){
s+='X';
}
if(kal==1){
s+='B';
}
if(kal==2){
s+='A';
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |