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 "combo.h"
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#pragma GCC target("avx2")
using namespace std;
#define pb push_back
#define sz size()
#define all(x) x.begin(), x.end()
#define F first
#define S second
typedef pair < int, int > pii;
typedef vector < int > vi;
typedef vector < vi > vvi;
string guess_sequence (int N) {
int n = N;
vector<string> a = {"A", "B", "X", "Y"};
int cur = press(a[0] + a[1]);
string ans = "";
if (cur != 0) {
cur = press(a[0]);
if (cur) {
ans += a[0];
swap(a[0], a[3]);
}
else {
ans += a[1];
swap(a[1], a[3]);
}
}
else {
cur = press(a[2]);
if (cur) {
ans += a[2];
swap(a[2], a[3]);
}
else {
ans += a[3];
}
}
for (int i = 2; i < n; i++) {
cur = press(ans + a[0] + ans + a[1] + a[0] + ans + a[1] + a[1] + ans + a[1] + a[2]);
if (cur == i) {
ans += a[0];
} else {
if (cur == i + 1) {
ans += a[1];
}
else {
ans += a[2];
}
}
}
cur = press(ans + a[0] + ans + a[1]);
if (cur == n) {
cur = press(ans + a[0]);
if (cur == n) {
ans += a[0];
}
else {
ans += a[1];
}
}
else {
ans += a[2];
}
return ans;
}
//void solve(){
//
//}
//
//signed main() {
// ios_base::sync_with_stdio(false);
// cin.tie(0); cout.tie(0);
// int t = 1;
// cin >> t;
// while (t--) {
// solve();
// cout << "\n";
// }
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |