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 ans,p;
char a[4];
string guess_sequence(int N) {
int c1=press("AB"),c;
int c2=press("AX");
if(c1==0&&c2==0){
a[0]='Y';
a[1]='A';
a[2]='B';
a[3]='X';
}
if(c1==0&&c2!=0){
a[0]='X';
a[1]='A';
a[2]='B';
a[3]='Y';
}
if(c1!=0&&c2==0){
a[0]='B';
a[1]='A';
a[2]='Y';
a[3]='X';
}
if(c1!=0&&c2!=0){
a[0]='A';
a[1]='Y';
a[2]='B';
a[3]='X';
}
ans=a[0];
if(N==1) return ans;
for (int i = 1; i <= N-2; ++i) {
p.clear();
p=ans+a[1]+a[1]+ans+a[1]+a[2]+ans+a[1]+a[3]+ans+a[2];
c=press(p);
if(c==i) ans.push_back(a[3]);
else if(c==i+1) ans.push_back(a[2]);
else if(c==i+2) ans.push_back(a[1]);
}
p.clear();
p=ans+a[1];
c=press(p);
if(c==N) return p;
p.clear();
p=ans+a[2];
c=press(p);
if(c==N) return p;
p.clear();
p=ans+a[3];
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |