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;
#define trav(a, x) for(auto &a: x)
#define sz(x) (int)x.size()
string guess_sequence(int n){
string a="ABXY", b="AB", d, s;
if(!press("AB"))
d="XY";
char fc = b[0];
if(!press(b.substr(0, 1)))
fc=b[1];
trav(c, a)
if(c!=fc)
d+=c;
s+=fc;
if(n<=1) return s;
while(sz(s)<n-1)
s+=d[press(s+d[1]+s+d[2]+d[0]+s+d[2]+d[1]+s+d[2]+d[2])-sz(s)];
if(press(s+d[0]+s+d[1])>sz(s)){
if(press(s+d[0])>sz(s))
return s+d[0];
return s+d[1];
}
return s+d[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |