I'm trying to solve this problem 103708A - Anya's gifts, in more detail, we need to do this.
Given an array A of length n (n≤105, ai<250), divide it into two subsequences X and Y such that (x1⊕...⊕x|X|)+(y1⊕...⊕y|Y|) is maximum. Print the maximum xor_sum(X)+xor_sum(Y).
It is obvious that for each 2p, if the ammount of elements ai such that ai and 2p=2p is odd, the answer will always have its p-th bit on. I don't know how to handle the case where it's even.
Any help would be appreciated. Thanks!