#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
char a='A', b='B', x='X', y='Y';
string s;
if (press("AB")){
if (press("A"));
else swap(a, b);
}else{
if (press("X")) swap(a, x);
else swap(a, y);
}
s.push_back(a);
while ((int)s.size()+2<=N){
string t=s+b+s+x+b+s+x+x+s+x+y;
int d=press(t)-(int)s.size();
if (d==0) s.push_back(y);
else if (d==1) s.push_back(b);
else s.push_back(x);
}
if ((int)s.size()!=N){
if (press(s+b)==N) s.push_back(b);
else if (press(s+x)==N) s.push_back(x);
else s.push_back(y);
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |