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 <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
#include "combo.h"
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;
const ld PI = 4*atan((ld)1);
char c[] = {'A', 'B', 'X', 'Y'};
char f;
char s[3];
string guess_sequence(int N) {
string ret = "";
int t = press("AB");
if (t > 0) {
int tmp = press("A");
if (tmp > 0) f = 'A';
else f = 'B';
}
else {
int tmp = press("X");
if (tmp > 0) f = 'X';
else f = 'Y';
}
int j = 0;
F0R(i, 4) {
if (c[i] == f) continue;
s[j] = c[i];
j++;
}
ret += f;
F0R(i, N - 2) {
t = press(ret + s[2] + s[0] + ret + s[2] + s[1] + ret + s[2] + s[2] + ret + s[1]);
ret += s[t - sz(ret)];
}
t = press(ret + s[0]);
if (t == N) return (ret + s[0]);
t = press(ret + s[1]);
if (t == N) return (ret + s[1]);
return (ret + s[2]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |