# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
765925 | tengiz05 | Combo (IOI18_combo) | C++17 | 1 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"
#include "iostream"
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
std::string guess_sequence(int n) {
string s;
if (press("AB") > 1) {
if (press("A")) {
s = "A";
} else {
s = "B";
}
} else {
if (press("X")) {
s = "X";
} else {
s = "Y";
}
}
string f = "ABXY";
f.erase(f.begin() + f.find(s[0]));
while (s.size() < n) {
if (n - s.size() == 1) {
if (press(s + f[0]) == n) {
s += f[0];
} else if (press(s + f[1]) == n) {
s += f[1];
} else {
s += f[2];
}
} else {
int val = press(s + f[0] + s + f[1] + f[0] + s + f[1] + f[1] + s + f[1] + f[2]);
if (val == s.size()) {
s += f[2];
} else if (val == s.size() + 1) {
s += f[0];
} else {
s += f[1];
}
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |