結果

問題 No.1072 A Nice XOR Pair
ユーザー kbyskbys
提出日時 2020-06-22 21:01:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 44,816 KB
最終ジャッジ日時 2023-09-16 19:24:08
合計ジャッジ時間 3,863 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,572 KB
testcase_01 AC 18 ms
8,472 KB
testcase_02 AC 21 ms
8,520 KB
testcase_03 AC 18 ms
8,644 KB
testcase_04 AC 18 ms
8,436 KB
testcase_05 WA -
testcase_06 AC 23 ms
8,736 KB
testcase_07 AC 572 ms
44,788 KB
testcase_08 WA -
testcase_09 AC 410 ms
16,192 KB
testcase_10 AC 420 ms
16,128 KB
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

N, X = map(int,input().split())

A = [0]*N
for i in range(N):
    A[i] = int(input())
    
cards = set(A)
cnt = collections.Counter(A)

ans = 0 
if X != 0:
    for key, value in cnt.items():
        if X^key in cards:
            ans += value*cnt[key]
    ans //= 2
else:
    for key, value in cnt.items():
        ans += cnt[key]*(cnt[key]-1)//2
        
print(ans)
0