結果

問題 No.1072 A Nice XOR Pair
コンテスト
ユーザー wattaihei
提出日時 2020-06-05 21:37:33
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 356 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 34,248 KB
最終ジャッジ日時 2026-10-04 16:04:35
合計ジャッジ時間 2,705 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline
from collections import Counter

N, X = map(int, input().split())
A = [int(input()) for _ in range(N)]

C = Counter(A)
ans = 0
if X == 0:
    for c, num in C.items():
        ans += c*(c-1)//2
else:
    for c, num in C.items():
        b = c ^ X
        if b in C:
            ans += C[b]*num

    ans //= 2
print(ans)
0