結果

問題 No.723 2つの数の和
ユーザー yurarayurara
提出日時 2019-05-16 21:55:20
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 11,808 KB
実行使用メモリ 25,188 KB
最終ジャッジ日時 2023-10-17 07:02:53
合計ジャッジ時間 4,007 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,144 KB
testcase_01 AC 29 ms
10,144 KB
testcase_02 AC 29 ms
10,144 KB
testcase_03 AC 111 ms
23,364 KB
testcase_04 AC 131 ms
24,484 KB
testcase_05 AC 124 ms
23,908 KB
testcase_06 AC 125 ms
23,816 KB
testcase_07 AC 76 ms
17,264 KB
testcase_08 AC 82 ms
18,244 KB
testcase_09 AC 135 ms
25,188 KB
testcase_10 AC 72 ms
17,248 KB
testcase_11 AC 40 ms
11,908 KB
testcase_12 AC 92 ms
18,540 KB
testcase_13 AC 141 ms
24,228 KB
testcase_14 AC 57 ms
14,636 KB
testcase_15 AC 79 ms
17,452 KB
testcase_16 AC 104 ms
22,940 KB
testcase_17 AC 124 ms
25,044 KB
testcase_18 AC 63 ms
11,936 KB
testcase_19 AC 80 ms
21,660 KB
testcase_20 AC 29 ms
10,144 KB
testcase_21 AC 29 ms
10,144 KB
testcase_22 AC 29 ms
10,144 KB
testcase_23 AC 131 ms
24,936 KB
testcase_24 AC 65 ms
17,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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

dic = defaultdict()
dic.default_factory = lambda: 0

for a in As:
    dic[a] += 1

count = 0
for key in list(dic.keys()):
    count += dic[key] * dic[X - key]
    
print(count)
0