結果

問題 No.1072 A Nice XOR Pair
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-27 23:52:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 223 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 109,696 KB
最終ジャッジ日時 2024-04-24 09:31:39
合計ジャッジ時間 3,047 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,632 KB
testcase_01 AC 45 ms
53,120 KB
testcase_02 AC 45 ms
53,376 KB
testcase_03 AC 45 ms
53,632 KB
testcase_04 AC 48 ms
53,504 KB
testcase_05 AC 45 ms
53,376 KB
testcase_06 AC 76 ms
69,120 KB
testcase_07 AC 223 ms
109,696 KB
testcase_08 AC 161 ms
77,952 KB
testcase_09 AC 159 ms
77,952 KB
testcase_10 AC 165 ms
77,952 KB
testcase_11 AC 195 ms
87,940 KB
testcase_12 AC 208 ms
105,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n,x = map(int,input().split())
A = [int(input()) for i in range(n)]
C = Counter(A)
ans = 0

for a in A:
    x2 = a^x

    if x2 in C:
        if x2 == a:
            ans += C[a]-1
        else:
            ans += C[x2]
print(ans//2)
0