# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
296987 | Touubs | Combo (IOI18_combo) | C++17 | 1 ms | 200 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 "combo.h"
using namespace std;
string keys;
char initKey;
std::string guess_sequence(int N) {
if (press("A")) {
keys = "BXY";
initKey = 'A';
} else if (press("B")) {
keys = "AXY";
initKey = 'B';
} else if (press("X")) {
keys = "ABY";
initKey = 'X';
} else {
keys = "ABX";
initKey = 'Y';
}
string sol = {initKey};
for (int i = 1; i < N-1; i++) {
string q;
q += sol;
q += {keys[0]};
for (char ot : keys) {
q += sol;
q += {keys[1], ot};
}
int res = press(q);
if (res == sol.size() + 1) sol.push_back(keys[0]);
else if (res == sol.size() + 2) sol.push_back(keys[1]);
else sol.push_back(keys[2]);
}
if (press(sol + (string(1, keys[0]))) == N) sol.push_back(keys[0]);
else if (press(sol + string(1, keys[1])) == N) sol.push_back(keys[1]);
else sol.push_back(keys[2]);
return sol;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |