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"
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
assert(l<=r);
return uniform_int_distribution<int> (l,r)(rng);
}
string guess_sequence(int n) {
string cur,s;
if(press("AB")){
if(press("A")) s="A",cur="BXY";
else s="B",cur="AXY";
}else{
if(press("X")) s="X",cur="ABY";
else s="Y",cur="ABX";
}
for(int i=1; i<n-1; i++){
string _s=s+cur[0]+s+cur[1]+cur[0]+s+cur[1]+cur[1]+s+cur[1]+cur[2];
int _=press(_s);
if(_==(int)s.size()) s+=cur[2];
else if(_==(int)s.size()+1) s+=cur[0];
else s+=cur[1];
}
if(n==1) return s;
if(press(s+cur[0])==n) return s+cur[0];
else if(press(s+cur[1])==n) return s+cur[1];
return s+cur[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |