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;
typedef long long ll;
// press(string)
string op="ABXY";
string guess_sequence(int n) {
string ans="";
ll temp=press("AB");
if(temp){
temp=press("A");
if(temp) ans+='A';
else ans+='B';
}
else{
temp=press("X");
if(temp) ans+='X';
else ans+='Y';
}
for(ll i=1;i<4;i++){
if(op[i]==ans[0]) swap(op[i],op[0]);
}
for(ll i=2;i<=n-1;i++){
string t="";
for(ll j=0;j<4;j++){
t+=ans;
if(j<=2) t+=op[1],t+=op[3-j];
else t+=op[2],t+=op[0];
for(ll k=ans.size()+2;k<n;k++) t+=op[0];
}
temp=press(t);
if(temp==i-1) ans+=op[3];
else if(temp==i) ans+=op[2];
else ans+=op[1];
}
if(n>1){
string t="";
t+=ans,t+=op[1];
t+=ans,t+=op[2];
temp=press(t);
if(temp==n){
t="";
t+=ans,t+=op[1];
temp=press(t);
if(temp==n) ans+=op[1];
else ans+=op[2];
}
else ans+=op[3];
}
cout<<ans<<endl;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |