結果

問題 No.1072 A Nice XOR Pair
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-23 15:46:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 479 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,520 KB
実行使用メモリ 31,660 KB
最終ジャッジ日時 2023-09-14 07:57:07
合計ジャッジ時間 3,736 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,580 KB
testcase_01 AC 17 ms
8,368 KB
testcase_02 AC 17 ms
8,572 KB
testcase_03 AC 16 ms
8,496 KB
testcase_04 AC 16 ms
8,548 KB
testcase_05 AC 16 ms
8,444 KB
testcase_06 AC 21 ms
8,720 KB
testcase_07 AC 479 ms
31,632 KB
testcase_08 AC 433 ms
16,232 KB
testcase_09 AC 377 ms
16,404 KB
testcase_10 AC 374 ms
16,404 KB
testcase_11 AC 437 ms
20,112 KB
testcase_12 AC 436 ms
31,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x=map(int,input().split())
a=[int(input()) for _ in range(n)]
from collections import Counter
ans=0
b=Counter(a)
if x==0:
    for key,val in b.items():
        ans+=val*(val-1)//2
    print(ans)
    exit()
for i in a:
    if i^x in b:
        ans+=b[i^x]
print(ans//2)
0