問題一覧 > 通常問題

No.1072 A Nice XOR Pair

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 283
作問者 : nmnmnmnmnmnmnm / テスター : Kiri8128
お気に入りにしたユーザー ProblemId : 3114 / 自分の提出
問題文最終更新日: 2020-05-28 21:02:32
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 251 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。