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) {
int x=press("AB"),y=press("AX"),val;
string a="ABXY";
if (x>0&&y==0)a="BAXY";
else if (x==0&&y>0)a="XABY";
else if (x==0&&y==0)a="YABX";
string ans(1,a[0]),s;
if (n==1)return ans;
for(int i=0;i<n-2;++i) {
s=ans+a[2];
for(int j=1;j<4;++j)s+=ans+a[1]+a[j];
val=press(s);
if (val==i+1) ans+=a[3];
else if (val==i+2) ans+=a[2];
else ans+=a[1];
}
if (press(ans+a[1]+ans+a[2])==n) {
if (press(ans+a[1])==n) return ans+a[1];
return ans+a[2];
}
return ans+a[3];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |