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"
#include <bits/stdc++.h>
using namespace std;
mt19937 bruh(chrono::steady_clock().now().time_since_epoch().count());
string guess_sequence(int N) {
string A = "ABXY", a1;
string p = "";
shuffle(A.begin(), A.end(), bruh);
for (auto c : A) {
p = c;
if (c == A[3] || press(p) == 1)
break;
}
for (auto c : A)
if (c != p[0])
a1 += c;
A = a1;
for (int i = 1; i < N; ++i) {
shuffle(A.begin(), A.end(), bruh);
int pref = i;
if (i + 2 <= N) {
string a = p + A[0] + A[0];
string b = p + A[0] + A[1];
string c = p + A[0] + A[2];
string d = p + A[1];
int cnt = press(a + b + c + d) - pref;
if (cnt == 2) {
p += A[0];
}
else if (cnt == 1) {
p += A[1];
}
else {
p += A[2];
}
}
else {
if (press(p + A[0]) - pref == 1)
p += A[0];
else if (press(p + A[1]) - pref == 1)
p += A[1];
else
p += A[2];
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |