# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136508 | shenxy | Combo (IOI18_combo) | C++11 | 0 ms | 0 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 <string>
#include <algorithm>
using namespace std;
string guess_sequence(int N) {
string p = "", k = "";
if (press("AB") != 0) {
if (press("A") != 0) {
p = "A";
k = "BXY";
} else {
p = "B";
k = "AXY";
}
else {
if (press("X") != 0) {
p = "X";
k = "ABY";
} else {
p = "Y";
k = "ABX";
}
}
while (p.length() < N - 1) {
int x = press(p + k[0] + k[1] + p + k[0] + k[2] + p + k[0] + k[0] + p + k[1]);
if (x == p.length() + 2) p += k[0];
else if (x == p.length() + 1) p += k[1];
else p += k[2];
}
if (press(p + k[0]) == N) return p + k[0];
else if (press(p + k[1]) == N) return p + k[1];
else return p + k[2];
}