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 "interactive.h"
using namespace std;
typedef vector <int> vi;
vi saz;
multiset <int> st, v[7];
vi guess (int n) {
int val = ask(1);
for (int i = 0; i < 7; i++) {
vi r;
for (int pos = 1; pos < n; pos++) {
if ((pos & (1 << i)) == 0) r.push_back(pos + 1);
}
if (r.empty()) {
v[i] = {val};
continue;
}
r.push_back(1);
vi p = get_pairwise_xor(r);
st.clear();
for (auto x : p) st.insert(x);
r.pop_back();
p = get_pairwise_xor(r);
for (auto x : p) st.erase(st.find(x));
for (auto x : st) {
saz.push_back(x ^ val);
v[i].insert(x ^ val);
}
}
sort(saz.begin(), saz.end());
saz.erase(unique(saz.begin(), saz.end()), saz.end());
vi res(n);
for (auto x : saz) {
int pos = (1 << 7) - 1;
for (int i = 0; i < 7; i++) {
if (v[i].find(x) != v[i].end()) pos -= (1 << i);
}
res[pos] = x;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |