No.1072 A Nice XOR Pair
タグ : / 解いたユーザー数 283
作問者 :
nmnmnmnmnmnmnm
/ テスター :
Kiri8128
Problem Statement
There are $N$ cards, each with a non-negative integer written on it.
The non-negative integer written on the $i$-th (1-indexed) card is $A_i$.
A pair of distinct integers $x$, $y$ ($1 \le x<y \le N$) is a nice pair if the bitwise XOR of $A_x$ and $A_y$ equals $X$.
How many ways are there to choose $x$, $y$ that form a nice pair?
Input
$N$ $X$ $A_1$ $A_2$ $\vdots$ $A_N$
$N$ is a positive integer. $2 \le N \le 200000=2\times10^5$.
$X$ is a non-negative integer. $0 \le X \le 1000000000=10^9$.
$A_i$ is a non-negative integer. $0 \le A_i \le 1000000000=10^9$.
Output
Output the answer, followed by a newline.
Sample
Sample 1
Input
3 1 3 1 2
Output
1
There is 1 way: choosing the 1st card and the 3rd card.
Sample 2
Input
5 4 2 2 6 6 6
Output
6
Be careful about how cards with the same number are handled.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。