# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
807634 | kingfran1907 | Combo (IOI18_combo) | C++14 | 29 ms | 576 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) {
string S;
string ls;
if (press("AB")) {
if (press("A")) S = "A";
else S = "B";
} else {
if (press("X")) S = "X";
else S = "Y";
}
for (char t : "ABXY") {
if (t != S[0]) ls.push_back(t);
}
ls.resize(3);
//cout << ls.size() << endl;
for (int i = 1; i < N - 1; i++) {
string qs = S;
qs.push_back(ls[0]);
for (char t : ls) {
qs += S;
qs.push_back(ls[1]);
qs.push_back(t);
}
//cout << "pressing: " << qs << endl;
//for (char t : qs) printf("%c|", t); printf("\n");
int out = press(qs);
if (out == S.size()) S.push_back(ls[2]);
else if (out == S.size() + 1) S.push_back(ls[0]);
else S.push_back(ls[1]);
}
for (int i = 0; i < 2; i++) {
string qs = S;
qs.push_back(ls[i]);
qs.resize(N);
if (press(qs) == N) return qs;
}
S.push_back(ls[2]);
S.resize(N);
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |