Substring Xor

4.2

15 votes
Binary Search, Data Structures, Medium, Tries
Problem

Given a length-n array a and a number k, there are subarrays in total. For each subarray, we can compute the xor sum of its elements.

In this problem, we will sort all these xor-sums in non-increasing order. And we want to find the element.

The first line contains two numbers n () and k ().

The second line contains n numbers - ().

Output the element in the non-increasing order.

Sample Input
5 10
1 4 3 12 8
Sample Output
4
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

All the xors of subarrays are , the is 4.

Editor Image

?