XOR Sum 2
Time limit2sMemory limit512 MB
Pick any subsequence of up to 100,000 numbers under 10^18 so that the XOR of the chosen elements is maximum.
- Level
Hard8 of 10
- Topics
- Bit manipulation, Greedy, Math
- Solved
- No attempts yet
Problem
You are given a sequence of numbers.
You want to choose a subsequence of . The XOR sum of a subsequence is the value obtained by XORing all of its elements together.
Given the sequence , write a program that finds the subsequence with the largest XOR sum.
Input
The first line contains the length of the sequence (). The second line contains the numbers of the sequence . Each number in is a positive integer less than or equal to .
Output
Print the XOR sum of the subsequence of whose XOR sum is the largest.