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> ans(n);
ans[0] = ask(1);
map<int, int> mp;
for (int bt = 0; bt < 7; bt++) {
vector<int> a;
for (int i = 2; i <= n; i++) {
if ((i >> bt) & 1) a.push_back(i);
}
vector<int> b;
if (!a.empty()) b = get_pairwise_xor(a);
a.push_back(1);
vector<int> c = get_pairwise_xor(a);
map<int, int> cnt;
for (int& j : b) {
cnt[j]--;
}
for (int& j : c) {
cnt[j]++;
}
for (auto& [x, y] : cnt) {
if (!y) continue;
mp[x] += (1 << bt);
}
}
for (auto& [x, y] : mp) {
ans[y-1] = x ^ ans[0];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |