https://www.codechef.com/problems/SUBARRAYXOR #include<bits/stdc++.h> using namespace std; const int N = 1e3 + 1; const int mod = 1e9 + 7; typedef long long ll; void solve() { int n; cin >> n; int c = 0; for (int i =1; i<= n; i ++) { cout << (c^i) << ...
voidinsert(trieNode*root,ll pre_xor,ll max_bits){trieNode*temp=root;boolval;for(ll i=max_bits;i>=0;i--){val=pre_xor&(1<arr[val]==NULL)temp->arr[val]=newNode();temp=temp->arr[val];}temp->value=pre_xor;} Given pre_xor the ideal value to xor it with is one that has 0...
So, we will sum-up all the no of subarrays with odd 1s for each bit (saysumisumi). so our answer would be∑sumi∗2i∑sumi∗2i. here2i2iis the contribution ofithith