SUBXOR - SubXor
A straightforward question. Given an array of positive integers you have to print the number of subarrays whose XOR is less than K. Subarrays are defined as a sequence of continuous elements Ai, Ai+1 ... Aj . XOR of a subarray is defined as Ai ^ Ai+1 ^ ... ^ Aj. Symbol ^ is Exclusive Or. You can read more about it here: en.wikipedia.org/wiki/Exclusive_or.
Input
First line contains T, the number of test cases. Each of the test case consists of N and K in one line, followed by N space separated integers in next line.
Output
For each test case, print the required answer.
Constraints
1 ≤ T ≤ 10
1 ≤ N ≤ 105
1 ≤ A[i] ≤ 105
1 ≤ K ≤ 106
Sum of N over all testcases will not exceed 105.
Sample Input:
1 5 2 4 1 3 2 7
Sample Output:
3
Explanation:
Only subarrays satisfying the conditions are [1], [1, 3, 2] and [3, 2].
Problem Setter: Lalit Kundu
hide comments
anando_du:
2015-05-26 17:56:25
time 1 s . I got ac 1.54 s :v :v
|
|
Praneeth.N:
2015-03-15 08:37:05
@darkshadows : Can you please help me..I keep getting wrong answer after 18/19 test case.
|
|
:D:
2015-02-02 21:45:07
Only three subarrays listed in "Explanation" meet the problem criteria:
|
|
vank:
2014-07-28 22:40:28
explain the test case.. |
|
adijimmy:
2014-05-29 13:50:39
good one ;) |
Added by: | darkshadows |
Date: | 2014-01-26 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |