# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115384 | kitoha | Combo (IOI18_combo) | C++14 | 1 ms | 256 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 key[] = { 'A','B','X','Y' };
string guess_sequence(int N) {
string s = "";
char element[3];
int pos = 0;
int idx = 0;
if (press("AB") >= 1) {
if (press("A") >= 1) s = "A", idx = 0;
else s = "B", idx = 1;
}
else {
if (press("XY") >= 1) {
if (press("X") >= 1) s="X", idx = 2;
else s="Y", idx = 3;
}
}
for (int i = 0; i <= 3; i++) {
if (idx == i) continue;
element[pos++] = key[i];
}
for (int i = 1; i < N; i++) {
string p = s + element[0] + element[0] + s + element[0] + element[1] + s + element[1];
int cnt = press(p);
if (cnt == s.size() + 2) s = s + element[0];
else if (cnt == s.size() + 1) s = s + element[1];
else s = s + element[2];
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |