XORX - x-Xor It!
Given an array of n integers and a number x. Your task is very simple. You have to find the subarray (length > 0) whose xor is maximum with x. Let's say the subarray as maxsubarray. You have to print the xor value of maxsubarray.
Input
First line of input consists of t test cases.
Second line of input contains two integers n and x.
Third line contains n space separated integers denoting the elements of array.
Output
First and only line of output is xor value of maxsubarray.
Constraints
1 ≤ t ≤ 10
1 ≤ n ≤ 200000
1 ≤ x ≤ 2×109
1 ≤ arr[i] ≤ 2×109 where arr[i] is any integer of array.
Example
Input: 1 3 7 1 2 3 Output: 0
taking 1^2^3 is 0 when taken xor with 7 gives us the maximum xor value.
hide comments
princemishra:
2021-11-26 10:09:49
INPUT-----
|
|
anonymous:
2020-05-08 16:29:13
There are test cases which do not satisfy specified constraints:
|
|
kshubham02:
2019-11-24 11:14:48
O(n*size_of_int) = O(n*32) is giving TLE! Is there a better solution?
|
|
vishal1510:
2018-10-01 15:47:14
Can't be empty. |
|
pugachag:
2018-10-01 15:28:30
In my AC submission I didn't consider empty subarrays, so you can safely assume that it can't be empty |
|
:D:
2018-10-01 13:14:31
Can the subarray be empty?
|
Added by: | kumarvishalgupta |
Date: | 2018-09-30 |
Time limit: | 1.399s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |