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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
vector<char> possivel;
string res = "";
string s = "AB";
int cont = press(s);
if(cont > 1){
if(press("A") == 1){
res += 'A'; possivel = {'B', 'X', 'Y'};
}
else {res += 'B'; possivel = {'A', 'X', 'Y'};}
}
else{
if(press("X")==1){res += 'X';possivel = {'B', 'A', 'Y'};}
else{res += 'Y'; possivel = {'B', 'X', 'A'};}
}
for(int i=1; i<N-1; i++){
string pref ="";
for(auto j: possivel){
pref += res;
pref += possivel[0];
pref += j;
}
pref += res;
pref += possivel[1];
cont = press(pref);
if(cont == i+1) res += possivel[1];
else if(cont == i+2) res+= possivel[0];
else res += possivel[2];
}
cont = press(res + possivel[0]);
if(cont == N){
res += possivel[0];
return res;
}
cont= press(res + possivel[1]);
if(cont == N){
res += possivel[1];
return res;
}
res += possivel[2];
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |