# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937078 | Muaath_5 | Combo (IOI18_combo) | C++17 | 1 ms | 596 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.
#ifdef MUAATH_5
#include "ioi.h"
#else
#include "combo.h"
#endif
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int n)
{
string sol = "";
vector<string> p = {"A", "B", "X", "Y"};
if (press("AB")) {
if (press("A"))
sol += "A";
else
sol += "B";
}
else {
if (press("X"))
sol += "X";
else
sol += "Y";
}
p.erase(find(p.begin(), p.end(), sol));
for (int i = 1; i < n-1; i++) {
string ask = "";
for (auto x : p)
ask += sol + p[0] + x;
ask += sol + p[1];
int res = press(ask);
if (res == i + 2)
sol += p[0];
else if (res == i + 1)
sol += p[1];
else
sol += p[2];
}
if (press(sol + p[0] + sol + p[1]) == sol.size() + 1) {
if (press(sol + p[0]) == sol.size() + 1)
sol += p[0];
else
sol += p[1];
}
else {
sol += p[2];
}
return sol;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |