結果

問題 No.1072 A Nice XOR Pair
ユーザー aaaaaaaaaa2230
提出日時 2022-03-27 23:52:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 109,480 KB
最終ジャッジ日時 2024-11-06 16:56:30
合計ジャッジ時間 2,787 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n,x = map(int,input().split())
A = [int(input()) for i in range(n)]
C = Counter(A)
ans = 0

for a in A:
    x2 = a^x

    if x2 in C:
        if x2 == a:
            ans += C[a]-1
        else:
            ans += C[x2]
print(ans//2)
0