# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769154 | pashka | Combo (IOI18_combo) | C++14 | 10 ms | 208 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"
char guess_first_letter() {
int x = press("AB");
if (x > 0) {
int y = press("A");
if (y > 0) {
return 'A';
} else {
return 'B';
}
} else {
int y = press("X");
if (y > 0) {
return 'X';
} else {
return 'Y';
}
}
}
std::string guess_sequence(int N) {
std::string s;
s += guess_first_letter();
std::string chars;
for (char c : "ABXY") {
if (c != s[0]) chars += c;
}
for (int i = 0; i < N - 2; i++) {
int x = press(
s + chars[0] + chars[0] +
s + chars[0] + chars[1] +
s + chars[0] + chars[2] +
s + chars[1]);
if (x == s.size()) {
s += chars[2];
} else if (x == s.size() + 1) {
s += chars[1];
} else {
s += chars[0];
}
}
int x = press(s + chars[0] + s + chars[1]);
if (x == N) {
x = press(s + chars[0]);
if (x == N) {
return s + chars[0];
} else {
return s + chars[1];
}
} else {
return s + chars[2];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |