#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
vector<int> guess(int n)
{
vector<int> v(n);
v[0] = ask(1);
map<int, int> poz;
if(n == 1) return v;
for(int bit = 6; bit >= 0; bit--)
{
vector<int> a;
for(int i = 2; i <= n; i++)
{
if(((1 << bit) & i) != 0)
a.push_back(i);
}
vector<int> a2 = a;
a2.push_back(1);
vector<int> b2 = get_pairwise_xor(a2);
vector<int> b = get_pairwise_xor(a);
map<int, int> mp;
for(auto it : b2) mp[it]++;
for(auto it : b) mp[it]--;
mp[0]--;
for(auto it : mp)
{
if(it.second == 0)
continue;
poz[it.first ^ v[0]] |= (1 << bit);
}
}
for(auto it : poz)
v[it.second - 1] = it.first;
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |