This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
////////////////////////////
// Gke vay sao //
////////////////////////////
#include <bits/stdc++.h>
//#define int long long
#define fi first
#include "combo.h"
#define se second
#define pb push_back
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
using ll = long long;
using ull = unsigned ll;
using ld = long double;
using pii = pair <int, int>;
using pil = pair <int, ll>;
using pli = pair <ll, int>;
using pll = pair <ll, ll>;
mt19937 Rand(chrono::steady_clock::now().time_since_epoch().count());
ll min(const ll &a, const ll &b){
return (a < b) ? a : b;
}
ll max(const ll &a, const ll &b){
return (a > b) ? a : b;
}
//const ll Mod = 1000000007;
//const ll Mod2 = 999999999989;
//only use when required
const int maxN = 1e5 + 1;
int n;
vector <string> c = {"A", "B", "X", "Y"};
vector <string> d;
string guess_sequence(int N){
n = N;
string p;
string first_char = "";
int t = press(p + c[0] + c[1]);
if (t){
t = press(p + c[0]);
if (t) first_char = c[0];
else first_char = c[1];
}
else{
t = press(p + c[2]);
if (t) first_char = c[2];
else first_char = c[3];
}
p += first_char;
if (n == 1) return first_char;
for (string &t: c){
if (t == first_char){
swap(t, c.back());
c.pop_back();
break;
}
}
d.pb(c[0] + first_char);
d.pb(c[1] + c[0]);
d.pb(c[1] + c[1]);
d.pb(c[1] + c[2]);
for (int i = 2; i < n; ++i){
int t = press(p + d[0] + p + d[1] + p + d[2] + p + d[3]);
if (t == i - 1) p += c[2];
if (t == i) p += c[0];
if (t == i + 1) p += c[1];
}
for (int i = 0; i < 2; ++i){
if (press(p + c[i]) == n){
return p + c[i];
}
}
return p + c[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |