# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
670812 | mdub | Combo (IOI18_combo) | C++14 | 29 ms | 588 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>
using namespace std;
int press(string p);
string guess_sequence(int N) {
string first;
string prefix, second;
string th1, th2, th3;
string other;
if (press("AB")) {
if (press("A"))
first = "A";
else
first = "B";
}
else if (press("X")) {
first = "X";
}
else first = "Y";
if (first == "A") {
prefix = "A";
second = "B";
th1 = "XB";
th2= "XX";
th3 = "XY";
other = "Y";
}
else if (first == "B") {
prefix = "B";
second = "A";
th1 = "XA";
th2 = "XX";
th3 = "XY";
other = "Y";
}
else if (first == "X") {
prefix = "X";
second = "A";
th1 = "BB";
th2 = "BA";
th3 = "BY";
other = "Y";
}
else {
prefix = "Y";
second = "A";
th1 = "BB";
th2 = "BX";
th3 = "BA";
other = "X";
}
if (N == 1) return prefix;
for (int i = 1; i < N - 1; i++) {
int temp = press(prefix + second + prefix + th1 + prefix + th2 + prefix + th3);
if (temp == prefix.size()) prefix += other;
else if (temp == prefix.size() + 1) prefix += second;
else prefix += th1[0];
}
if (press(prefix+ second) == N) return prefix + second;
else if (press(prefix + th1[0]) == N) return prefix + th1[0];
else return prefix + other;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |