# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
87149 | AlexPop28 | Combo (IOI18_combo) | C++11 | 51 ms | 560 KiB |
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>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'
#include "combo.h"
using namespace std;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef long long ll;
typedef unsigned long long ull;
string guess_sequence (int N) {
string p = "", cand = "", s;
int aux;
p = press ("AB") ? (press ("A") ? "A" : "B") : (press ("X") ? "X" : "Y");
for (char c : "ABXY") {
if (c == p[0]) continue;
cand += c;
}
if (p.size() == N) return p;
for (int i = 2; i <= N - 1; ++i) {
s = p + cand[0] + p + cand[1] + cand[0] + p + cand[1] + cand[1] + p + cand[1] + cand[2];
aux = press (s);
if (aux == i - 1) {
p += cand[2];
} else if (aux == i) {
p += cand[0];
} else {
p += cand[1];
}
}
for (int i = 0; i < 2; ++i) {
aux = press (p + cand[i]);
if (aux == N) return (p + cand[i]);
}
return (p + cand[2]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |