# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127005 | kingfran1907 | Combo (IOI18_combo) | C++14 | 2 ms | 200 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 <bits/stdc++.h>
using namespace std;
const char koj[] = "ABXY";
string guess_sequence(int n) {
string s;
char ac = 'Z';
for (int i = 0; i < 3; i++) {
string tren; tren += koj[i];
if (press(tren) == 1) ac = koj[i];
}
if (ac == 'Z') ac = 'Y';
char a = 0, b = 0, c = 0;
for (int i = 0; i < 4; i++) {
if (koj[i] == ac) continue;
if (a == 0) a = koj[i];
else if (b == 0) b = koj[i];
else c = koj[i];
}
assert(a > 0 && b > 0 && c > 0);
s += ac;
for (int i = 1; i < n - 1; i++) {
string query = s + a + s + b + c + s + b + b;
int kol = press(query);
if (kol == s.size()) s.push_back(c);
else if (kol == s.size() + 1) s.push_back(a);
else s.push_back(b);
};
for (int i = 0; i < 4; i++) {
if (koj[i] == ac) continue;
string query = s + koj[i];
if (press(query) == n) {
s += koj[i];
break;
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |