# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
749628 | tamyte | Combo (IOI18_combo) | C++14 | 1 ms | 292 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<bits/stdc++.h>
#include "combo.h"
using namespace std;
const string code = "ABXYY";
// int press(string s) {
// int ans = 0;
// // cerr << "a";
// for (int i = 0; i < s.size();) {
// int j = i, ptr = 0;
// while (j < s.size() && code[ptr] == s[j]) {
// j++; ptr++;
// }
// i = max(j, i + 1);
// // cerr << s << " " << ptr << "\n";
// ans = max(ans, ptr);
// }
// return ans;
// }
string guess_sequence(int N) {
vector<string> el = {"A", "B", "X", "Y"};
string ans = "";
if (press(el[0])) {
ans += el[0];
} else if (press(el[1])) {
ans += el[1];
} else if (press(el[2])) {
ans += el[2];
} else {
ans += el[3];
}
vector<char> fin;
for (auto u : el) {
if (ans[0] != u[0]) {
fin.push_back(u[0]);
}
}
for (int i = 1; i < N; ++i) {
string guess = ans + fin[0] + fin[0] + ans + fin[0]
+ fin[1] + ans + fin[0] + fin[2];
if (press(guess) == ans.size()) {
guess = ans + fin[1] + fin[1] + ans + fin[1] + fin[2];
if (press(guess) == ans.size()) {
ans += fin[2];
} else {
ans += fin[1];
}
} else {
ans += fin[0];
}
if (ans.size() == N) return ans;
}
return ans;
}
// int main () {
// cout << guess_sequence(code.size());
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |