結果

問題 No.1072 A Nice XOR Pair
ユーザー convexineqconvexineq
提出日時 2020-06-05 21:27:49
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 36,540 KB
最終ジャッジ日時 2023-08-22 14:14:15
合計ジャッジ時間 2,401 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,784 KB
testcase_01 AC 16 ms
7,792 KB
testcase_02 AC 15 ms
7,864 KB
testcase_03 AC 15 ms
7,844 KB
testcase_04 AC 15 ms
7,816 KB
testcase_05 AC 15 ms
7,892 KB
testcase_06 AC 17 ms
8,480 KB
testcase_07 AC 253 ms
36,364 KB
testcase_08 AC 190 ms
29,884 KB
testcase_09 AC 191 ms
29,868 KB
testcase_10 AC 203 ms
29,840 KB
testcase_11 AC 200 ms
30,884 KB
testcase_12 AC 173 ms
36,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,k,x,y *a = map(int,read().split())
n,x,*a = map(int,read().split())

d = {}
for i in a:
    if i in d: d[i] += 1
    else: d[i] = 1

ans = 0
for i in a:
    if x^i in d: ans += d[x^i]

if x==0:
    ans -= n

print(ans//2)
0