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;
std::string guess_sequence(int N) {
std::string p = "";
int k = 0;
int res = press("AB");
if(res){
res = press("A");
if(res) p+="A";
else p+="B";
}
else{
res = press("X");
if(res) p+="X";
else p+="Y";
}
k++;
vector<string> aux;
string query;
if(p != "A") aux.push_back("A");
if(p != "B") aux.push_back("B");
if(p != "X") aux.push_back("X");
if(p != "Y") aux.push_back("Y");
for(int i = 1; i<N-1; i++){
query = p+aux[0]+p+(aux[1]+aux[0])+p+(aux[1]+aux[1])+p+(aux[1]+aux[2]);
res = press(query);
if(res-k == 2){
p+=aux[1];
}
else if(res-k == 1){
p+=aux[0];
}
else{
p+=aux[2];
}
k++;
}
if(N>1){
query = p + aux[0];
res = press(query);
if(res-k>0) p += aux[0];
else{
query = p + aux[1];
res = press(query);
if(res-k) p+=aux[1];
else p+=aux[2];
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |