# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256770 | lani1akea | Combo (IOI18_combo) | C++17 | 3086 ms | 384 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>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string p = "";
vector<char> LET = {'A', 'B', 'X', 'Y'};
int x, y, st = 0;
y = press({"AB"});
if (y >= 1) {
st = y;
p += (y == 2 ? "AB" : "A");
} else {
y = press({"BX"});
if (y >= 1) {
st = y;
p += (y == 2 ? "BX" : "B");
} else {
y = press({"XY"});
if (y >= 1) {
st = y;
p += (y == 2 ? "XY" : "X");
} else {
st = 1;
p += "Y";
}
}
}
if (p[0] == 'A')
LET.erase(LET.begin());
else if (p[0] == 'B')
LET.erase(LET.begin() + 1);
else if (p[0] == 'X')
LET.erase(LET.begin() + 2);
else
LET.erase(LET.begin() + 3);
for (int i = st; i < N; ++i) {
set<int>s;
while(true) {
random_shuffle(LET.begin(), LET.end());
if (s.count(LET[0])) {
continue;
}
y = press(p + LET[0] + LET[1] + LET[2]);
if (y >= i + 1) {
if (y == i + 1) {
p += LET[0];
} else if ( y == i + 2) {
p += LET[0];
p += LET[1];
++i;
} else {
p += LET[0];
p += LET[1];
p += LET[2];
i += 2;
}
break;
} else {
s.insert(LET[0]);
continue;
}
}
}
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |