Teachers and students
Practice
2.4 (7 votes)
Basic programming
Basics of implementation
Implementation
Medium
Adhoc
Problem
29% Success 6926 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

There are N students in a class and each student has a number denoted by an array A. The teacher will select three students and give a task to each of them. The first student has to find a number of subsets of students having cumulative xor less than K. The second student has to find a number of subsets of students having cumulative xor equal to K. The third student has to find a number of subsets of students having cumulative xor greater than K. Let the three numbers returned by the selected students are cnt1, cnt2 and cnt3. You need to find the value of :

\((cnt1+cnt2)^2+(cnt2+cnt3)^2+(cnt3+cnt1)^2-(cnt1^2+cnt2^2+cnt3^2)\)

 

Input Format :

The first line contains an integer T denoting the number of test cases.

The first 2 lines of each test case have 2 integers N and K respectively.

Next line has N integers denoting the array A.

Output Format :

Print answer for each test case under modulo \(10^9+7\) in a new line.

Constraints :

\(1 \leq T \leq 20\)

\(1 \leq N,K, A[i]\leq 10^5\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
5 votes
Tags:
Basic Programming
Points:30
3 votes
Tags:
Basic ProgrammingBasics of ImplementationHash MapsImplementationMedium
Points:30
17 votes
Tags:
ApprovedImplementationMediumOpenString Manipulation