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;
string guess_sequence(int N) {
//string p = "";
char ot[3];
string ans;
if(press("A")==1)
ans="A",ot[0]='B',ot[1]='X',ot[2]='Y';
else if(press("B")==1)
ans="B",ot[0]='A',ot[1]='X',ot[2]='Y';
else if(press("X")==1)
ans="X",ot[0]='B',ot[1]='A',ot[2]='Y';
else
ans="Y",ot[0]='B',ot[1]='X',ot[2]='A';
//int coins = press(p);
string S;
// cout<<N<<'\n';
if(N==1) return ans;
for (int i = 2; i <N; ++i) {
S = ans+ot[0]+ans+ot[1]+ot[0]+ans+ot[1]+ot[1]+ans+ot[1]+ot[2];
//cout<<S<<' ';
// cout<<S.size()<<'\n';
int p=press(S);
if(p==i-1) ans+=ot[2];
else if(p==i) ans+=ot[0];
else ans+=ot[1];
//cout<<ans<<'\n';
}
if(press(ans+ot[0])==N) ans+=ot[0];
else if( press(ans+ot[1])==N) ans+=ot[1];
else ans+=ot[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |