# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1004372 | The_Samurai | Combo (IOI18_combo) | C++17 | 1 ms | 344 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;
int counter;
int ask(string t) {
counter++;
return press(t);
}
string guess_sequence(int n) {
string s = "ABXY", ans = "";
for (int i = 0; i < 4 and n == 1; i++) {
if (press(string(s[i], 1))) return string(s[i], 1);
}
if (ask("AB") >= 1) {
// if (press("A")) ans = "A";
// else ans = "B";
ans = (ask("A") ? "A" : "B");
} else {
// if (press("X")) ans = "X";
// else ans = "Y";
ans = (ask("X") ? "X" : "Y");
}
s.erase(find(s.begin(), s.end(), ans[0]));
for (int i = 1; i < n - 1; i++) {
string t = "";
t += ans + s[0];
t += ans + s[1] + s[0];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |