#P10853. 【MX-X2-T2】「Cfz Round 4」Xor Counting
【MX-X2-T2】「Cfz Round 4」Xor Counting
Background
生きてもいいような 気がして
Or maybe it is fine to just keep living like this.
繰返し笑い合うんだ 居たくなる旅
I want a journey full of repeated laughter, one that makes me want to stay.
Problem Description
Given a sequence of length consisting of non-negative integers.
Please find the number of index pairs that satisfy . Here, denotes bitwise XOR, i.e. ^ in C++.
Input Format
This problem contains multiple test cases.
The first line contains an integer , denoting the number of test cases.
Then each test case is given as follows:
- The first line contains an integer .
- The second line contains integers .
Output Format
For each test case, output one integer per line, denoting the number of index pairs that satisfy the condition.
7
4
3 0 1 3
5
0 1 2 3 4
1
6
1
0
6
1 1 4 5 1 4
10
10 32 43 28 19 83 10 10 83 23
15
132 256 852 31 1 0 12 13 12 0 0 255 143 23 32
6
6
0
1
3
12
65
Hint
[Sample Explanation]
For the -st test case, the index pairs that satisfy the condition are .
[Constraints]
Let denote the sum of within a single test point.
For all testdata, , , , .
This problem uses bundled judging.
- Subtask 1 (30 points): .
- Subtask 2 (30 points): .
- Subtask 3 (40 points): no special constraints.
Translated by ChatGPT 5