# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203875 | staniewzki | Combo (IOI18_combo) | C++14 | 0 ms | 0 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>
using namespace std;
#include "combo.h"
string let = "ABXY";
string conv(basic_string<int> a) {
string str;
for(int x : a)
str += let[x];
return str;
}
int query(basic_string<int> a) {
return press(conv(a));
}
string guess_sequence(int n) {
int f = -1;
if(query({0, 1})) f = (query({0}) ? 0 : 1);
else f = (query({2}) ? 2 : 3);
swap(let[f], let[3]);
basic_string<int> cur = {3};
FOR(i, 1, n - 2) {
for(int i = 1; i <= n - 2; i++) {
auto g = cur + 2 + 0 + cur + 2 + 1 + cur + 2 + 2 + cur + 1;
cur += query(g) - i;
}
if(query(cur + 0)) cur += 0;
else if(query(cur + 1)) cur += 1;
else cur += 2;
return conv(cur);
}