結果

問題 No.1072 A Nice XOR Pair
ユーザー 👑 rin204
提出日時 2020-08-13 08:27:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 753 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 19,756 KB
最終ジャッジ日時 2024-10-09 19:02:56
合計ジャッジ時間 5,483 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right, bisect_left

n, x = map(int, input().split())
alst = [int(input()) for _ in range(n)]
ans = 0
alst.sort()
for a in alst:
    xor = a ^ x
    ans += bisect_right(alst, xor) - bisect_left(alst, xor)
    if 0 == x:
        ans -= 1
print(ans // 2)
0