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
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
// random
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// templates
template<class X, class Y>
bool maximize(X &x, const Y &y) {
if (y > x) {
x = y;
return (true);
} else return (false);
}
template<class X, class Y>
bool minimize(X &x, const Y &y) {
if (y < x) {
x = y;
return (true);
} else return (false);
}
// define
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define eb emplace_back
#define upb upper_bound
#define lwb lower_bound
#define left VAN
#define right TAN
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).begin(),(a).end()
#define sort_and_unique(a) sort(all(a));(a).resize(unique(all(a))-a.begin())
// another define
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
// limit
const int oo = 2e9;
string guess_sequence(int N) {
string c = "ABXY";
if (press("AB") >= 1) {
if (press("A") == 1) {
} else {
swap(c[0], c[1]);
}
} else {
if (press("X") == 1) {
swap(c[0], c[2]);
} else {
swap(c[0], c[3]);
}
}
string S = "";
S += c[0];
for (int i = 2; i < N; i++) {
string str = S + c[1] + c[1] + S + c[1] + c[2] + S + c[1] + c[3] + S + c[2];
int sz = (int)S.size();
int taken = press(str);
//cerr << str << ' ' << taken << '\n';
if (taken - sz == 2)
S += c[1];
else if (taken - sz == 1)
S += c[2];
else S += c[3];
}
for (int i = 1; i <= 2; i++) {
string str = S + c[i];
if (press(str) == N) {
S += c[i];
return (S);
}
}
if (N >= 2)
S += c[3];
return (S);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |