atcoder#ARC098B. [ABC098D] Xor Sum 2
[ABC098D] Xor Sum 2
Score : points
Problem Statement
There is an integer sequence of length .
Find the number of the pairs of integers and () that satisfy the following condition:
- $A_l\ xor\ A_{l+1}\ xor\ ...\ xor\ A_r = A_l\ +\ A_{l+1}\ +\ ...\ +\ A_r$
Here, denotes the bitwise exclusive OR.
Definition of XOR
The XOR of integers is defined as follows:
- Let the XOR be . In the binary representation of , the digit in the 's place (; is an integer) is if there are an odd number of integers among whose binary representation has in the 's place, and if that number is even.
For example, let us compute the XOR of and . The binary representation of is , and the binary representation of is , thus the XOR has the binary representation , that is, the XOR is .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of the pairs of integers and () that satisfy the condition.
4
2 5 4 6
5
clearly satisfy the condition. also satisfies the condition, since . There are no other pairs that satisfy the condition, so the answer is .
9
0 0 0 0 0 0 0 0 0
45
19
885 8 1 128 83 32 256 206 639 16 4 128 689 32 8 64 885 969 1
37