結果

問題 No.1072 A Nice XOR Pair
ユーザー RustyRusty
提出日時 2023-01-17 15:55:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 121,652 KB
最終ジャッジ日時 2023-08-30 19:53:38
合計ジャッジ時間 4,281 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,724 KB
testcase_01 AC 89 ms
71,580 KB
testcase_02 AC 90 ms
71,752 KB
testcase_03 AC 89 ms
71,672 KB
testcase_04 AC 90 ms
71,532 KB
testcase_05 AC 91 ms
71,888 KB
testcase_06 AC 125 ms
77,836 KB
testcase_07 AC 259 ms
103,376 KB
testcase_08 AC 195 ms
84,732 KB
testcase_09 AC 195 ms
84,692 KB
testcase_10 AC 205 ms
84,968 KB
testcase_11 AC 276 ms
99,584 KB
testcase_12 AC 294 ms
121,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
d = defaultdict(int)
n,x = map(int,input().split())
L = []
for i in range(n):
    a = int(input())
    L.append(a)
    d[a] += 1

ans = 0
for i in range(n):
    ax = L[i]
    if d[ax^x] > 0 and ax^x != ax:
        ans += d[ax^x]
    elif d[ax^x] > 1 and ax^x == ax:
        ans += d[ax^x]-1
print(ans//2)
0