# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
418133 | ja_kingy | Combo (IOI18_combo) | C++14 | 1 ms | 200 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 ls = "ABXY";
string ans;
if (press("AB")) {
ans = press("A") ? "A" : "B";
} else {
ans = press("X") ? "X" : "Y";
}
ls.erase(find(ls.begin(), ls.end(), ans[0]));
string p;
for (int i = 1; i < N-1; ++i) {
p = ans + ls[0] + ls[0] + ans + ls[0] + ls[1] + ans + ls[0] + ls[2] + ans + ls[1];
int res = press(p);
if (res == ans.size() + 2) {
ans.push_back(ls[0]);
} else if(res == ans.size()+1) {
ans.push_back(ls[1]);
} else {
ans.push_back(ls[2]);
}
}
p = ans + ls[0];
if (press(p) == N) ans.push_back(ls[0]);
else {
p = ans + ls[1];
if (press(p) == N) ans.push_back(ls[1]);
else {
ans.push_back(ls[2]);
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |