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"
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
string guess_sequence(int N) {
string p;
for (char i : {'A', 'B', 'X', 'Y'}) {
p.pb(i);
if (press(p)) {
for (int j = 1; j < N; j++) {
p.pb(i);
}
break;
}
p.pop_back();
}
vector<char> v;
for (char i : {'A', 'B', 'X', 'Y'}) {
if (p[0] == i) continue;
v.pb(i);
}
int idx = 1;
while (idx < N) {
for (int j = 0; j < 3; j++) {
int k = j + rand() % (3 - j);
swap(v[j], v[k]);
}
for (int i = idx+1; i - idx + 1 <= idx && i < N; i++) {
p[i] = v[rand() % 3];
}
for (char &i : v) {
p[idx] = i;
int x = press(p);
if (x > idx) {
idx = x;
break;
}
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |