# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503736 | sliviu | Combo (IOI18_combo) | C++14 | 29 ms | 652 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;
string guess_sequence(int N) {
string s = "", left;
char first;
if (press("AB"))
if (press("A"))
s += (first = 'A');
else
s += (first = 'B');
else
if (press("X"))
s += (first = 'X');
else
s += (first = 'Y');
for (auto x : "ABXY")
if (x != first)
left += x;
for (int i = 2; i <= N - 1; ++i) {
string q = s + left[0] + left[0] + s + left[0] + left[1] + s + left[0] + left[2] + s + left[1];
int qry = press(q);
if (qry == s.length() + 2)
s += left[0];
else if (qry == s.length() + 1)
s += left[1];
else
s += left[2];
}
if (N != 1) {
if (press(s + left[0]) == N)
s += left[0];
else
if (press(s + left[1]) == N)
s += left[1];
else
s += left[2];
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |