Grand XOR Counting Problem Challenge II
题号:NC295131
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
64bit IO Format: %lld

题目描述

The annual GXCPC (Grand XOR Counting Problem Challenge) is here again! This year, Judge Colin has prepared another super difficult counting problem for the contestants! Can you slay this ultimate counting problem and win the championship?

Eva has two magic parameters k_1 and k_2.
Colin has two integer sequences a_1,a_2,\cdots,a_n and b_1,b_2,\cdots,b_n.
They want to know how many pairs of indices (i,j) satisfying:
  • 1\le i<j\le n
  • k_1 \oplus a_i \oplus a_j <k_2 \oplus b_i \oplus b_j
Where \oplus represents the bitwise XOR operation.

输入描述:

The first line contains three integers n,k_1,k_2~(1\le n\le 2\times 10^5,1\le k_1,k_2< 2^{30}), representing the length of the two sequences and the magic parameters.

The second line contains n integers a_1,a_2,\cdots,a_{n}\ (1\le a_i<2^{30}), representing the first sequence.

The third line contains n integers b_1,b_2,\cdots,b_{n}\ (1\le b_i<2^{30}), representing the second sequence.

输出描述:

A single integer, representing the number of pairs satisfying the condition.
示例1

输入

复制
5 1 2
3 4 5 6 7
1 2 3 1 2

输出

复制
2

说明

There are two valid pairs in the sample: (2, 3) and (4, 5)