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:
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.
For each test case, print the required answer.
1 ≤ T ≤ 10
1 ≤ N ≤ 10^5
1 ≤ A[i] ≤ 10^5
1 ≤ K ≤ 10^6
Sum of N over all testcases will not exceed 10^5.
1 5 2 4 1 3 2 7
Only subarrays satisfying the conditions are , [1,3,2] and [3,2].
Problem Setter: Lalit Kundu
please use long long for answer
tough to implement.
Nice problem!Last edit: 2018-08-18 12:56:17
In Case if anyone needs help.
I think there is some bug with time limits firstly same problem on codechef is getting AC(1.83 sec) with time limit of 2 seconds . Here solution with 1.54s is getting AC so what's the point of stating time limit of 1 sec. @ darkshadows
Don't forget nothing.
make the number of bits in all the numbers that u will be processing equal which can be done by adding leading zeros for example make the number of bits in all numbers equal to 20 and then proceed, this will avoid any wrong answers.
use long long for answer
I had to use fast input using getchar_unlocked to avoid TLE
time 1 s . I got ac 1.54 s :v :v