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