結果

問題 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  
実行時間 323 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,084 KB
最終ジャッジ日時 2024-05-09 20:09:51
合計ジャッジ時間 2,123 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 26 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 28 ms
10,624 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 323 ms
34,084 KB
testcase_08 AC 136 ms
18,688 KB
testcase_09 AC 140 ms
18,688 KB
testcase_10 AC 135 ms
18,560 KB
testcase_11 AC 188 ms
22,552 KB
testcase_12 AC 211 ms
33,932 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