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"
#define bit(x, y) (((x) >> (y)) & 1)
using namespace std;
vector<int> guess(int n)
{
map<int,int> pos;
vector<int> res(n);
res[0] = ask(1);
for (int b = 0; b < 7; b++) {
vector<int> tmp;
for (int i = 2; i <= n; i++) {
if (bit(i, b)) tmp.push_back(i);
}
if (tmp.empty()) break;
vector<int> mim = get_pairwise_xor(tmp);
tmp.push_back(1);
vector<int> mim1 = get_pairwise_xor(tmp);
map<int,int> mp;
for (int x : mim1) mp[x]++;
for (int x : mim) mp[x]--;
for (pair<int,int> p : mp) {
if (p.first && p.second) pos[p.first ^ res[0]] |= (1 << b);
}
}
for (pair<int,int> p : pos) {
res[p.second - 1] = p.first;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |