結果

問題 No.1072 A Nice XOR Pair
ユーザー Rusty
提出日時 2023-01-17 15:55:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 117,276 KB
最終ジャッジ日時 2025-01-02 15:33:46
合計ジャッジ時間 3,109 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
d = defaultdict(int)
n,x = map(int,input().split())
L = []
for i in range(n):
    a = int(input())
    L.append(a)
    d[a] += 1

ans = 0
for i in range(n):
    ax = L[i]
    if d[ax^x] > 0 and ax^x != ax:
        ans += d[ax^x]
    elif d[ax^x] > 1 and ax^x == ax:
        ans += d[ax^x]-1
print(ans//2)
0