結果

問題 No.1072 A Nice XOR Pair
ユーザー convexineqconvexineq
提出日時 2020-06-05 21:27:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 38,268 KB
最終ジャッジ日時 2024-05-09 19:58:55
合計ジャッジ時間 2,649 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 29 ms
10,496 KB
testcase_02 AC 29 ms
10,496 KB
testcase_03 AC 29 ms
10,496 KB
testcase_04 AC 29 ms
10,496 KB
testcase_05 AC 29 ms
10,496 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 315 ms
38,040 KB
testcase_08 AC 238 ms
32,540 KB
testcase_09 AC 245 ms
32,540 KB
testcase_10 AC 243 ms
32,404 KB
testcase_11 AC 247 ms
30,812 KB
testcase_12 AC 220 ms
38,268 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