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 <bits/stdc++.h>
#include "combo.h"
#define SZ(x) (int)x.size()
typedef long long ll;
using namespace std;
std::string guess_sequence(int N) {
std::string p = "";
string options = "";
ll coins = press("AB");
if(coins>=1){
coins=press("A");
if(coins==1) options = "BXY", p+="A";
else options = "AXY", p+="B";
}else{
coins = press("X");
if(coins==1) options = "ABY",p+="X";
else options = "ABX",p+="Y";
}
//cout<<p<<'\n';
string aux = "";
for(int i = 1; i < N-1; i++){
aux=p+options[0]+options[0];
aux+=p+options[0]+options[1];
aux+=p+options[0]+options[2];
aux+=p+options[1];
//cout<<aux<<" ";
coins = press(aux);
if(coins==SZ(p)+2) p+=options[0];
else if(coins==SZ(p)+1) p+=options[1];
else p+=options[2];
//cout<<p<<'\n';
}
if(N==1) return p;
aux=p+options[0];
coins=press(aux);
if(coins>=SZ(p)+1) p+=options[0];
else{
aux=p+options[1];
coins=press(aux);
if(coins>=SZ(p)+1) p+=options[1];
else p+=options[2];
}
//cout<<p<<'\n';
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |