CODEIT02  PICK UP DROP ESCAPE
PICK UP DROP ESCAPE
You are given with an array of n numbers. You must pick K elements from the array such that XOR of all the chosen elements is maximum.
http://en.wikipedia.org/wiki/Bitwise_operation#XOR
Input Specification:
The first line consists of an integer t representing the number of test cases. For each test case the first line consists of two numbers n and K denoting the number of elements in the array and the number of elements to be chosen respectively. Then in the next n lines, the elements in the array are given.
Output Specification:
For each test case print a line containing one integer denoting the maximum XOR value of the chosen K elements.
Input Constraints:
1<=t<=100
1<=n<=20
1<=k<=n
1<=element value<=10000
Sample Input:
2
5 3
1
2
3
4
5
5 3
3
4
5
7
4
Sample Output:
7
7
hide comments
scolar_fuad:
20191107 18:44:57
Can I apply bitmask approach here >? 

pshiphon:
20190711 20:56:13
[spoiler removed] Last edit: 20191104 16:29:10 

Aman Parashar:
20150604 08:10:24
Best Solution :) Last edit: 20150604 08:57:57 

Rishabh Joshi:
20150526 20:33:33
did this just after XMAX. Didnt interpret the question clearly. got 45 WA.

Added by:  cegprakash 
Date:  20120109 
Time limit:  0.107s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 