#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
std::string guess_sequence(int N) {
/*A B X Y*/
string p="";
string p1="AB";
int ans=press(p1);
if (ans==1) {
p+="A";
}
if (ans==2) {
p+="AB";
}
if (ans==0) {
string p2="X";
int ans2=press(p2);
if (ans2==1) {
p+=p2;
}
else {
p+="Y";
}
}
string fix1, fix2, fix3;
if (p[0] == 'X') {
fix1 = "A";
fix2 = "B";
fix3 = "Y";
}
if (p[0] == 'Y') {
fix1 = "A";
fix2 = "B";
fix3 = "X";
}
if (p[0] == 'A') {
fix1 = "X";
fix2 = "B";
fix3 = "Y";
}
if (p[0] == 'B') {
fix1 = "A";
fix2 = "X";
fix3 = "Y";
}
while (p.size()!=N) {
string pnext=p+fix1+p+fix2+fix3+p+fix2+fix1+p+fix2+fix2;// 0 - fix3 1-fix1 2-fix2
int count=press(pnext);
if (count==p.size()+0) {
p+=fix3;
}
if (count==p.size()+1) {
p+=fix1;
}
if (count==p.size()+2) {
p+=fix2;
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |