結果

問題 No.1072 A Nice XOR Pair
ユーザー hir355hir355
提出日時 2020-06-05 21:32:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 31,680 KB
最終ジャッジ日時 2023-08-22 14:26:27
合計ジャッジ時間 1,975 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,500 KB
testcase_01 AC 18 ms
8,564 KB
testcase_02 AC 18 ms
8,632 KB
testcase_03 AC 18 ms
8,540 KB
testcase_04 AC 17 ms
8,456 KB
testcase_05 AC 17 ms
8,544 KB
testcase_06 AC 20 ms
8,656 KB
testcase_07 AC 262 ms
31,620 KB
testcase_08 AC 102 ms
16,360 KB
testcase_09 AC 103 ms
16,220 KB
testcase_10 AC 105 ms
16,216 KB
testcase_11 AC 150 ms
20,148 KB
testcase_12 AC 173 ms
31,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
import sys
input = sys.stdin.readline
n, x = map(int, input().split())
a = [int(input()) for _ in range(n)]
c = Counter(a)
ans = 0
if x == 0:
    for k, v in c.items():
        ans += (v * (v - 1) // 2)
else:
    for k, v in c.items():
        if k ^ x in c:
            ans += v * c[k ^ x]
    ans //= 2
print(ans)
0