# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425342 | dariasc | Combo (IOI18_combo) | C++14 | 0 ms | 200 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;
char chars[] = {'A', 'B', 'X', 'Y'};
string guess_sequence(int N) {
string S = "";
for (auto btn : chars) {
if (press(string(1, btn)) == 1) {
S += btn;
break;
}
}
while (S.size() < N) {
int asked = 0;
for (int i = 0; i < 4; i++) {
char btn = chars[i];
if (btn != S[0]) {
// we don't need to ask 3 times
if (asked == 2) {
S += btn;
break;
}
string cpy = S;
cpy += btn;
if (press(cpy) > S.size()) {
S += btn;
break;
}
asked++;
}
}
}
cout << S << endl;
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |