# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199347 | mythos | Combo (IOI18_combo) | C++14 | 58 ms | 564 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string p = "";
if (press("AB") >= 1) p = press("A") ? "A" : "B";
else p = press("X") ? "X" : "Y";
vector<char> chr = {'A', 'B', 'X', 'Y'};
chr.erase(find(chr.begin(), chr.end(), p[0]));
while ((int) p.size() <= N - 2) {
int que = press(p + chr[0] + chr[0] + p + chr[0] + chr[1] + p + chr[1] + chr[0]);
if (que == (int) p.size()) p.push_back(chr[2]);
else if (que == p.size() + 1) {
que = press(p + chr[1] + chr[2]);
if (que == (int) p.size()) p = p + chr[0] + chr[2];
else if (que == (int) p.size() + 1) p = p + chr[1] + chr[1];
else p = p + chr[1] + chr[2];
}
else {
que = press(p + chr[0] + chr[1]);
if (que == (int) p.size()) p = p + chr[1] + chr[0];
else if (que == (int) p.size() + 1) p = p + chr[0] + chr[0];
else p = p + chr[0] + chr[1];
}
}
while ((int) p.size() != N) {
if (press(p + chr[0]) == (int) p.size() + 1) p.push_back(chr[0]);
else if (press(p + chr[1]) == (int) p.size() + 1) p.push_back(chr[1]);
else p.push_back(chr[2]);
}
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |