結果

問題 No.1072 A Nice XOR Pair
ユーザー freecss00
提出日時 2020-06-05 21:59:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,384 KB
最終ジャッジ日時 2024-12-17 14:46:40
合計ジャッジ時間 5,807 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

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

ans = 0
for i in range(n):
    ans += bisect.bisect_right(b, a[i]) - bisect.bisect_left(b, a[i])
ans //= 2
if x == 0:
    ans -= n
print(ans)
0