結果

問題 No.1072 A Nice XOR Pair
ユーザー kohei2019kohei2019
提出日時 2021-01-02 14:38:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 692 ms / 2,000 ms
コード長 258 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,036 KB
最終ジャッジ日時 2024-04-20 08:29:31
合計ジャッジ時間 5,111 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 36 ms
10,880 KB
testcase_07 AC 692 ms
34,036 KB
testcase_08 AC 596 ms
18,688 KB
testcase_09 AC 626 ms
18,816 KB
testcase_10 AC 620 ms
18,688 KB
testcase_11 AC 644 ms
22,552 KB
testcase_12 AC 678 ms
33,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#x^y=X,y=x^X
import collections
N,X = map(int,input().split())
lsA = [int(input()) for i in range(N)]
counter = collections.Counter(lsA)
ans = 0
for i in range(N):
    x = lsA[i]
    c = counter[x^X]
    if x == x^X:
        c -= 1
    ans += c
print(ans//2)
0