結果

問題 No.1072 A Nice XOR Pair
ユーザー 👑 rin204rin204
提出日時 2020-08-13 08:27:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 751 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 19,696 KB
最終ジャッジ日時 2024-04-18 01:20:39
合計ジャッジ時間 5,418 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 32 ms
10,880 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,880 KB
testcase_04 AC 29 ms
10,624 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 36 ms
10,752 KB
testcase_07 AC 720 ms
19,572 KB
testcase_08 AC 678 ms
18,816 KB
testcase_09 AC 679 ms
18,560 KB
testcase_10 AC 748 ms
19,696 KB
testcase_11 AC 727 ms
19,616 KB
testcase_12 AC 751 ms
19,628 KB
権限があれば一括ダウンロードができます

ソースコード

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