結果

問題 No.1072 A Nice XOR Pair
ユーザー syunsukesyunsuke
提出日時 2020-09-15 22:49:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 1,625 ms
コンパイル使用メモリ 86,296 KB
実行使用メモリ 92,708 KB
最終ジャッジ日時 2023-09-04 03:04:20
合計ジャッジ時間 3,230 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,440 KB
testcase_01 AC 69 ms
71,332 KB
testcase_02 AC 68 ms
71,424 KB
testcase_03 AC 71 ms
71,204 KB
testcase_04 AC 71 ms
71,172 KB
testcase_05 AC 68 ms
71,432 KB
testcase_06 AC 94 ms
76,952 KB
testcase_07 AC 219 ms
92,708 KB
testcase_08 AC 157 ms
77,256 KB
testcase_09 AC 159 ms
77,232 KB
testcase_10 AC 162 ms
77,428 KB
testcase_11 AC 212 ms
85,300 KB
testcase_12 AC 217 ms
91,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

D={}
for i in range(N):
    A=int(input())
    if A not in D:
        D[A]=1
    else:
        D[A]+=1

ans=0
if X==0:
    for k,v in D.items():
        ans+=v*(v-1)
    print(ans//2)


else:
    for k,v in D.items():
        if X^k in D:
            ans+=D[X^k]*v
    print(ans//2)
0