結果

問題 No.1072 A Nice XOR Pair
ユーザー FromBooska
提出日時 2023-10-18 12:38:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 417 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 81,584 KB
実行使用メモリ 111,868 KB
最終ジャッジ日時 2024-09-18 08:58:04
合計ジャッジ時間 2,725 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

# Ai^Aj=Xということは、Ai=Aj^X
# Counter
# X==0 and or Ai==0のときは別対応必要なのか?

N, X = map(int, input().split())
A = []
for i in range(N):
    A.append(int(input()))
from collections import Counter
counted = Counter(A)

ans = 0
for i in range(N):
    xa = X^A[i]
    calc = counted[xa]
    ans += calc
ans //= 2 #双方から数えているのでダブルカウントしている
print(ans)
0