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;
#define rep(i,s,e) for (int i = s; i <= e; ++i)
#define rrep(i,s,e) for (int i = s; i >= e; --i)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<ll> vll;
string guess_sequence(int n) {
int ab = press("AB"), ax = press("AX");
string a = "ABXY";
if (ab>0 && ax==0) a = "BAXY";
else if (ab==0 && ax>0) a = "XABY";
else if (ab==0 && ax==0) a = "YABX";
string ans(1,a[0]);
if (n==1) return ans;
rep (i,1,n-2) {
string s;
rep (j,1,3) s += ans+a[1]+a[j];
s += ans+a[2];
int val = press(s);
if (val==(int)ans.size()) ans += a[3];
else if (val==(int)ans.size()+1) 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... |