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;
typedef long long ll;
std::string guess_sequence(int N) {
string s, t;
if(press(s+'A'+s+'B')>=1) {
if(press(s+'A')>=1){
s+='A';
t="BXY";
}
else{
s+='B';
t="AXY";
}
}
else{
if(press(s+'X')>=1){
s+='X';
t="ABY";
}
else{
s+='Y';
t="ABX";
}
}
if(N==1) return s;
for(ll i=1; i<N-1; i++){
ll ans=press(s+t[0]+s+t[1]+t[0]+s+t[1]+t[1]+s+t[1]+t[2]);
if(ans==i) s+=t[2];
else if(ans==i+1) s+=t[0];
else s+=t[1];
}
if(press(s+t[0]+s+t[1])>=N) {
if(press(s+t[0])>=N){
s+=t[0];
}
else{
s+=t[1];
}
}
else{
s+=t[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |