結果

問題 No.1072 A Nice XOR Pair
ユーザー freecss00freecss00
提出日時 2020-06-05 22:15:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 692 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,860 KB
最終ジャッジ日時 2024-12-17 15:51:31
合計ジャッジ時間 4,660 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

n, x = map(int, input().split())
a = [int(input()) for _ in range(n)]

d = collections.defaultdict(int)
ans = 0
for i in range(n):
    d[a[i]] += 1
for k in [k for k in d.keys()]:
    u = d[k]
    v = d[k^x]
    ans += u * v
    if x == 0:
        ans -= u
print(ans//2)
0