# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
984491 | kachim2 | Combo (IOI18_combo) | C++17 | 0 ms | 344 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"
std::string guess_sequence(int N) {
std::string S = "";
if (press("AB") != 0) {
if (press("A") == 1) {
S = 'A';
}
else {
S='B';
}
} else {
if (press("X") == 1) {
S = 'X';
}
else {
S = 'Y';
}
}
std::string A = "A", B = "B", C = "X";
switch (S[0]) {
case 'A':
A = "Y";
break;
case 'B':
B = "Y";
break;
case 'X':
C = "Y";
break;
default:
break;
};
for (int i = 1; i < N - 1; i++) {
int ans = press(S + A + S + B + C + S + B + A);
if (ans == i+1) {
S+=A;
} else if (ans == i+2){
S+=B;
} else {
S+=C;
}
}
if (press(S + A) == S.size()) {
if (press(S + B) == S.size()) {
S+= C;
} else {
S+=B;
}
} else {
S+=A;
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |