| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1351630 | Omar_G | Combo (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int n) {
string c = "ABXY", s = "";
for (int i = 0; i < 3; i++) {
string b = c[i];
if (press(b)) {
s = c[i];
swap(c[i], c[3]);
break;
}
}
if (!s.size()) s = c[3];
while (s.size() + 1 < n) {
string q = s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2] + s + c[1];
int a = press(q);
if (a == s.size() + 2) s += c[0];
else if (a == s.size() + 1) s += c[1];
else s += c[2];
}
for (int i = 0; i < 2; i++) {
if (press(s + c[i]) == n) {
return s+c[i];
}
}
return s + c[2];
}