#include "interactive.h"
// #include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
set<int> G(vector<int> vec, int n, int a1)
{
vector<int> v1 = get_pairwise_xor(vec);
vec.push_back(1);
vector<int> v2 = get_pairwise_xor(vec);
multiset<int> s1;
for(auto i : v2)
s1.insert(i);
for(auto i : v1)
s1.erase(s1.find(i));
s1.erase(0);
set<int> res;
for(auto i : s1)
res.insert(i ^ a1);
return res;
}
vector<int> guess(int N)
{
int n = N;
int a1 = ask(1);
map<int, int> mp;
mp[a1] = 1;
vector<int> V;
for(int k = 0; k < 7; k++)
{
V.clear();
for(int i = 2; i <= n; i++)
{
if((i >> k) & 1)
V.push_back(i);
}
set<int> S = G(V, n, a1);
for(auto i : S)
mp[i] |= (1 << i);
}
vector<int> res(n + 1);
for(auto i : mp)
res[i.second] = i.first;
res.erase(res.begin());
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |