#include "combo.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
std::string guess_sequence(int N) {
std::string p = "";
string lts = "ABXY";
string l="";
string lt="";
if (press("AB")){
p = (press("A")) ? "A" : "B";
}else {
p = (press("X")) ? "X" : "Y";
}
for (char x : lts){
if (x==p.back())continue;
if ((int)lt.size()==2)l+=x;
else{
lt+=x;
}
}
while ((int)p.size() < N){
string juan = p+lt[0]+p+lt[1];
if (press(juan) == (int)p.size())p+=l;
else{
string juan_la_venganza=p+lt[0];
if (press(juan_la_venganza)==(int)p.size()+1)p+=lt[0];
else p+=lt[1];
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |