Chef and Xor
All submissions for this problem are available.
One day Chef was bunking his classes and was playing games. His teacher saw him playing and got very angry at him. So next day he called him and asked him to solve a problem if he can solve it then he will not be punished else His teacher will call his parents and tell them all about it. The chef got scared and agreed to it. As his teacher knew that Chef is bad at calculating XOR of numbers so he gave him an Array of length N and asked him to count the number of unordered pairs X such that after calculating XOR of the pair the resulting number's last bit is 1. Your task is to help Chef find the count of such pairs.Note:The output can be very large so output it modulo 109 + 7.
- The first line contains an integer T denoting the number of test cases.
- The first line of each test case contains an integer N denoting the number of integers in the array.
- The second line contains N space-separated intergers denoting the array elements.
For each test case output the count of unordered pairs X in a new line.
- 1 ≤ T ≤ 1000
- 1 ≤ N ≤ 105
- 0 ≤ A[i] ≤ 105
1 3 1 2 3
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.