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 <iostream>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
string sol;
map < char, int > br;
string guess_sequence(int n){
br['A']=0;
br['B']=1;
br['X']=2;
br['Y']=3;
int q;
q=press("AB");
if(q){
q=press("A");
if(q){
sol.push_back('A');
}
else{
sol.push_back('B');
}
}
else{
q=press("X");
if(q){
sol.push_back('X');
}
else{
sol.push_back('Y');
}
}
string opcije="ABXY";
opcije.erase(opcije.begin()+br[sol[0]]);
string pitam;
for(int i=1; i<n-1; i++){
pitam=sol+opcije[0]+opcije[0]+sol+opcije[0]+opcije[1]+sol+opcije[0]+opcije[2]+sol+opcije[1];
q=press(pitam);
if(q==(int)sol.size()+2){
sol.push_back(opcije[0]);
}
else if(q==(int)sol.size()+1){
sol.push_back(opcije[1]);
}
else{
sol.push_back(opcije[2]);
}
}
pitam=sol+opcije[0];
q=press(pitam);
if(q==n){
return pitam;
}
pitam=sol+opcije[1];
q=press(pitam);
if(q==n){
return pitam;
}
else{
return sol+opcije[2];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |