# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425344 | dariasc | Combo (IOI18_combo) | C++14 | 64 ms | 548 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 = "Y";
for (int i = 0; i < 3; i++) {
if (press(string(1, chars[i])) == 1) {
S = string(1, chars[i]);
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++;
}
}
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |