#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
#define ll long long
#define N 200005
#define pb push_back
#define ff first
#define ss second
#define sz(s) (int)s.size()
int val;
vector <int> a, b, h;
vector <pair<int,int> > answer;
map <int,int> vis, vip;
vector <int> guess(int n) {
val = ask(n);
answer.pb(make_pair(val, n));
for(int i = 0; i <= 7; i++) {
b.clear();
h.clear();
vip.clear();
for(int j = 1; j < n; j++) {
if((j&(1 << i))) b.pb(j);
}
if(!sz(b)) continue;
vector <int> a1 = get_pairwise_xor(b);
b.pb(n);
vector <int> a2 = get_pairwise_xor(b);
for(auto j : a1) {
vip[j]++;
}
for(auto j : a2) {
vip[j]--;
}
for(auto j : vip) {
if(j.ff && j.ss)
vis[j.ff ^ val] |= (1 << i);
}
}
for(auto i:vis) {
a[i.ss - 1] = i.ff;
}
a[n - 1] = val;
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |