# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
914991 | shenfe1 | Xoractive (IZhO19_xoractive) | C++17 | 0 ms | 0 KiB |
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"
#pragma GCC optimize("03")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mem(a,i) memset(a,i,sizeof(a))
#define sz(s) (int)s.size()
#define y1 yy
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define in insert
const int MAX=3e5+15;
const int B=2e5;
const int N=104;
const int block=450;
const int maxB=MAX/B+10;
const ll inf=1e18;
const int mod=1e9+7;
const int mod1=1e9+9;
const ld eps=1e-9;
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,-1,1,-1};
int a[MAX],b[MAX];
map<int,int> mp;
// int ask(int pos){
// return b[pos];
// }
// vector<int> get_pairwise_xor(vector<int> f){
// vector<int> res;
// for(int x:f){
// for(int y:f){
// res.pb(b[x]^b[y]);
// }
// }
// sort(all(res));
// return res;
// }
vector<int> guess(int n){
vector<int> ans;
a[1]=ask(1);
for(int i=0;i<7;i++){
vector<int> ask,ask1;
for(int j=2;j<=n;j++){
if((j>>i)&1){
ask.pb(j);
ask1.pb(j);
}
}
ask1.pb(1);
sort(all(ask1));
vector<int> v=get_pairwise_xor(ask);
vector<int> v1=get_pairwise_xor(ask1);
// for(int pos:ask)cout<<pos<<" ";
// cout<<"\n";
// for(int pos:ask1)cout<<pos<<" ";
// cout<<"\n";
multiset<int> st;
for(int x:v1)st.in(x);
for(int x:v){
st.erase(st.find(x));
}
st.erase(st.find(x));
set<int> st1;
for(int x:st)st1.in(x);
for(int x:st1){
mp[(x^a[1])]+=(1<<i);
}
}
for(pii x:mp){
a[x.S]=x.F;
}
for(int i=1;i<=n;i++)ans.pb(a[i]);
return ans;
}
// int main(){
// int n;
// cin>>n;
// for(int i=1;i<=n;i++)cin>>b[i];
// vector<int> f=guess(n);
// for(int x:f)cout<<x<<" ";
// }