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) {
unordered_map<int, int> mp;
for (int k = 0; k < 7; ++k) {
vector<int> xs;
for (int i = 1; i < n; ++i)
if (i & (1 << k))
xs.push_back(i);
if (xs.empty()) continue;
auto small = get_pairwise_xor(xs);
xs.push_back(n);
auto large = get_pairwise_xor(xs);
for (int x: small)
large.erase(lower_bound(large.begin(), large.end(), x));
for (int x: large)
mp[x] |= 1 << k;
}
int x = ask(n);
vector<int> xs(n);
for (auto [k, v]: mp) if (k != 0)
xs[v-1] = k ^ x;
xs.back() = x;
return xs;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |