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;
using namespace string_literals;
const int t = chrono::high_resolution_clock::now().time_since_epoch().count();
inline int gen(int i) {
static mt19937 rng = mt19937(t%10000/10);
return rng() % i;
}
string guess_sequence(int N) {
string cur = ""; cur.reserve(N);
// Find first character (essentially random, so check each one)
for (const char c: "ABXY") {
if (press(""s+c)) {
cur += c; break;
}
}
for (int i = 1; i < N; ++i) {
char s[5] = "ABXY";
random_shuffle(s, s+4, gen);
for (const char c: s) {
if (c == cur[0]) continue;
cur += c;
if (press(cur) == i+1) break;
cur.pop_back();
}
}
return cur;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |