# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
756164 | thinknoexit | Combo (IOI18_combo) | C++17 | 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 <iostream>
using namespace std;
string guess_sequence(int N) {
string ans = "";
string p = "";
if (press("AB")) {
if (press("A")) ans = "A", p = "BXY";
else ans = "B", p = "AXY";
}
else {
if (press("X")) ans = "X", p = "ABY";
else ans = "Y", p = "ABX";
}
while (p.size() != N - 1) {
int t = press(p + c[0] + p + c[1] + c[0] + p + c[1] + c[1] + p + c[1] + c[2]);
if (p.size() == t - 1) p += c[0];
else if (p.size() == t - 2) p += c[1];
else p += c[2];
}
if (p.size() != press(p + c[0])) p += c[0];
else if (p.size() != press(p + c[1])) p += c[1];
else p += c[2];
return p;
}