# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1110888 | HasanV11010238 | Combo (IOI18_combo) | C++17 | 1 ms | 508 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 <vector>
using namespace std;
vector<char> c = {'A', 'B', 'X', 'Y'};
string guess_sequence(int N){
string ans = "", q;
int l = 0, r = 3;
while (l != r){
int mid = (l + r) / 2;
q = "";
for (int i = l; i <= mid; i++){
q += c[i];
}
if (press(q) == 0){
l = mid + 1;
}
else{
r = mid;
}
}
vector<char> al;
for (int i = 0; i < 4; i++){
if (l != i){
al.push_back(c[i]);
}
}
ans += c[l];
for (int i = 0; i < N - 2; i++){
q = ans + al[0] + ans + al[1] + al[0] + ans + al[1] + al[1] + ans + al[1] + al[2];
int res = press(q);
if (res == ans.size()){
ans += al[2];
}
else if (res == ans.size() + 1){
ans += al[0];
}
else{
ans += al[1];
}
}
if (press(ans + al[0]) == N) return ans + al[0];
if (press(ans + al[1]) == N) return ans + al[1];
return ans + al[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |