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 "interactive.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> guess(int n) {
vector<int> a(n);
a[0] = ask(1);
map<int, int> pos;
for (int bit = 0; bit < 7; bit++) {
vector<int> ind;
for (int i = 1; i < n; i++) {
if ((i >> bit) & 1) {
ind.push_back(1 + i);
}
}
if (ind.empty()) {
continue;
}
vector<int> ind_1 = ind;
ind_1.push_back(1);
vector<int> vals = get_pairwise_xor(ind);
vector<int> vals_1 = get_pairwise_xor(ind_1);
map<int, int> cnt;
for (int value : vals_1) {
cnt[value]++;
}
for (int value : vals) {
cnt[value]--;
}
cnt[0]--;
for (auto [key, value] : cnt) {
if (value > 0) {
pos[key ^ a[0]] |= 1 << bit;
}
}
}
for (auto [key, value] : pos) {
a[value] = key;
}
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |