結果

問題 No.1072 A Nice XOR Pair
ユーザー NoviNovi
提出日時 2020-06-06 15:08:27
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 491 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 31,696 KB
最終ジャッジ日時 2023-08-25 01:03:28
合計ジャッジ時間 3,709 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,624 KB
testcase_01 AC 16 ms
8,460 KB
testcase_02 AC 17 ms
8,608 KB
testcase_03 AC 17 ms
8,572 KB
testcase_04 AC 17 ms
8,456 KB
testcase_05 AC 17 ms
8,452 KB
testcase_06 AC 22 ms
8,616 KB
testcase_07 AC 491 ms
31,612 KB
testcase_08 AC 375 ms
16,552 KB
testcase_09 AC 373 ms
16,476 KB
testcase_10 AC 373 ms
16,156 KB
testcase_11 AC 426 ms
20,208 KB
testcase_12 AC 484 ms
31,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import  collections
n,x=map(int,input().split())
a=[int(input()) for i in range(n)]
ans=0
tmp=collections.Counter(a)
ty=tmp.items()
if x==0:
    for i,j in ty:
        ans+=(j*(j-1)//2)
    print(ans)
else:
    for i , j in ty:
        b=i^x
        ans+=tmp[b]*j
    print(ans//2)
0