# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
826955 | wortelworm | Combo (IOI18_combo) | C++17 | 43 ms | 584 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;
std::string guess_sequence(int N) {
char first;
int coins = press("AB");
if (coins > 0) {
coins = press("A");
if (coins > 0) {
first = 'A';
} else {
first = 'B';
}
} else {
coins = press("X");
if (coins > 0) {
first = 'X';
} else {
first = 'Y';
}
}
string result = "";
result += first;
string options;
for (char c : "ABXY") {
if (c != first) {
options += c;
}
}
for (int i = 1; i < N; i++) {
for (int j = 0; j < 2; j++) {
coins = press(result + options[j]);
if (coins > result.size()) {
// this is correct
result += options[j];
}
}
if (result.size() == i) {
result += options[2];
}
}
return result;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |