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"
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;
string guess_sequence(int n){
string s="AB";
int u=press(s);
string ans;
if(u){
s="A";
u=press(s);
if(u){
ans+='A';
}
else{
ans+='B';
}
}
else{
s="X";
u=press(s);
if(u){
ans+='X';
}
else{
ans+='Y';
}
}
if(n==1){
return ans;
}
char d='$',e='$',f='$';
string v="ABXY";
for(int i=0;i<4;i++){
if(v[i]==ans[0]){
continue;
}
if(d=='$'){
d=v[i];
}
else if(e=='$'){
e=v[i];
}
else if(f=='$'){
f=v[i];
}
}
for(int i=1;i<n-1;i++){
string z=ans+d+ans+e+d+ans+e+e+ans+e+f;
u=press(z);
if(u==i+1){
ans+=d;
}
else if(u==i+2){
ans+=e;
}
else{
ans+=f;
}
}
string y=ans+d;
if(press(y)==n){
ans+=d;
}
else{
string t=ans+e;
if(press(t)==n){
ans+=e;
}
else{
ans+=f;
}
}
return ans;
}
//
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |