logo AlgoBeat OnlineJudge
登录 注册

#215732. [ICPC 2024 Jakarta R] Xorderable Array

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 .

样例

样例输入 1

3 4
0 3 0
1 2 1 1

样例输出 1

3

样例输入 2

5 2
0 7 13 22 24
12 10

样例输出 2

1

样例输入 3

3 3
0 0 0
1 2 3

样例输出 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 .