# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
832771 | kamelfanger83 | Combo (IOI18_combo) | C++14 | 25 ms | 464 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 <iostream>
#include <vector>
#include <string>
#include "combo.h"
using namespace std;
string guess_sequence(int N){
int f = press("AB"), s = press("AX");
string res;
if (f && s) res = "A";
else if (f) res = "B";
else if (s) res = "X";
else res = "Y";
vector<string> lchars;
for (auto c : {'A', 'B', 'X', 'Y'}) if (c != res[0]) lchars.push_back(string({c}));
while (res.size() < N - 1){
int ans = press(res + lchars[0] + lchars[0] + res + lchars[0] + lchars[1] + res + lchars[1] + lchars[0]);
if (ans == res.size()) res += lchars[2];
else if (ans == res.size() + 1) {
int sans = press(res + lchars[1] + lchars[1]);
if (sans == res.size()) res += lchars[0] + lchars[2];
else if (sans == res.size() + 1) res += lchars[1] + lchars[2];
else res += lchars[1] + lchars[1];
}
else {
int sans = press(res + lchars[0] + lchars[0]);
if (sans == res.size()) res += lchars[1] + lchars[0];
else if (sans == res.size() + 1) res += lchars[0] + lchars[1];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |