#include <bits/stdc++.h>
#include "interactive.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define rep(a,b,c) for(ll a=b; a<c; a++)
#define rep2(a,b,c,d) for(ll a=b; a<c; a+=d)
#define repr(a,b,c) for(ll a=b-1; a>c-1; a--)
#define repa(a,b) for(const auto &a: b)
#define multicase() int t; cin>>t; while(t--)
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define valid(c) cout<<(c ? "YES" : "NO")<<endl;
#define valid2(c,a,b) cout<<(c ? a : b)<<endl;
#define pq_min(a) priority_queue<a, vector<a>, greater<a>>
#define pq_max(a) priority_queue<a>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mid ((l+r)>>1)
#define flush endl<<flush
#define all(a) a.begin(), a.end()
using namespace std;
using namespace __gnu_pbds;
using vi = vector<int>;
using ll = long long;
template <typename T>
using vec = vector<T>;
template <typename T>
using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
vector<int> guess(int n){
vi ans(n);
int x=ask(1);
map<int,int> mp;
rep(i,0,7){
vi pos, ans1, ans2;
rep(j,1,n){
if(i&(1<<j)){
pos.pb(j+1);
}
}
if(!pos.size()) continue;
ans1=get_pairwise_xor(pos);
pos.pb(1);
ans2=get_pairwise_xor(pos);
multiset<int> a;
repa(e,ans2) a.insert(e);
repa(e,ans1) a.erase(a.find(e));
repa(e,a) mp[e]|=(1<<i);
}
ans[0]=x;
repa(e,mp) if(e.fi) ans[e.se]=e.fi^x;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |