# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
252564 | ChrisT | Combo (IOI18_combo) | C++17 | 40 ms | 672 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<bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence (int n) {
string ret; char fi;
if (press("XY")) {
ret += (fi = press("X") ? 'X' : 'Y');
} else {
ret += (fi = press("A") ? 'A' : 'B');
}
char a = 'A' + (fi == 'A');
char b = fi <= 'B' ? 'X' : 'B';
char c = fi <= 'X' ? 'Y' : 'X';
for (int i = 2; i < n; i++) {
int go = press(ret + a + ret + b + a + ret + b + b + ret + b + c);
if (go == i+1) ret += b;
else if (go == i) ret += a;
else ret += c;
}
if (ret.length() < n) {
int go = press(ret + a + ret + b);
if (go == n) {
ret += press(ret + a) == n ? a : b;
} else {
ret += c;
}
}
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |