# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107152 | nickyrio | Combo (IOI18_combo) | C++17 | 64 ms | 608 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 st;
vector<char> Char = {'A', 'B', 'X', 'Y'};
if (press("AB") > 0) {
if (press("A")) st = "A";
else st = "B";
} else {
if (press("X")) st = "X";
else st = "Y";
}
for (int i = 0; i < 4; ++i) if (Char[i] == st[0]) {
Char.erase(Char.begin() + i);
}
for (int i = 1; i < N - 1; ++i) {
string p = st + Char[0];
for (int j = 0; j < 3; ++j) p = p + st + Char[1] + Char[j];
int res = press(p);
if (res == st.size()) {
st.push_back(Char[2]);
} else {
if (res == st.size() + 1) {
st.push_back(Char[0]);
} else st.push_back(Char[1]);
}
}
if (N > 1) {
if (press(st + Char[0]) == N) {
return st + Char[0];
}
if (press(st + Char[1]) == N) {
return st + Char[1];
}
return st + Char[2];
}
return st;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |