#P15677. [ICPC 2024 Jakarta R] Xorderable Array
[ICPC 2024 Jakarta R] Xorderable Array
题目描述
You are given an array of integers: .
The array is -xorderable if it is possible to rearrange such that for each pair that satisfies , the following conditions must be satisfied after the rearrangement: and . The operator represents the bitwise xor.
You are given another array of length : . Calculate the number of pairs where array is -xorderable for .
输入格式
The first line consists of two integers ( .
The second line consists of integers ( .
The third line consists of integers ( .
输出格式
Output a single integer representing the number of pairs where array is -xorderable for .
3 4
0 3 0
1 2 1 1
3
5 2
0 7 13 22 24
12 10
1
3 3
0 0 0
1 2 3
0
提示
Explanation for the sample input/output #1
The array is -xorderable by rearranging the array to .
Explanation for the sample input/output #2
The array is -xorderable by rearranging the array to .