結果

問題 No.723 2つの数の和
ユーザー toyuzukotoyuzuko
提出日時 2020-06-19 23:24:57
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 10,696 KB
実行使用メモリ 23,328 KB
最終ジャッジ日時 2023-09-16 15:40:51
合計ジャッジ時間 3,271 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,536 KB
testcase_01 AC 18 ms
8,448 KB
testcase_02 AC 18 ms
8,476 KB
testcase_03 AC 82 ms
17,976 KB
testcase_04 AC 105 ms
19,272 KB
testcase_05 AC 94 ms
19,068 KB
testcase_06 AC 101 ms
18,732 KB
testcase_07 AC 53 ms
14,436 KB
testcase_08 AC 58 ms
14,400 KB
testcase_09 AC 98 ms
19,556 KB
testcase_10 AC 54 ms
14,528 KB
testcase_11 AC 26 ms
9,764 KB
testcase_12 AC 65 ms
14,924 KB
testcase_13 AC 102 ms
19,848 KB
testcase_14 AC 39 ms
12,044 KB
testcase_15 AC 53 ms
14,656 KB
testcase_16 AC 74 ms
16,992 KB
testcase_17 AC 87 ms
18,460 KB
testcase_18 AC 55 ms
10,276 KB
testcase_19 AC 71 ms
20,104 KB
testcase_20 AC 18 ms
8,516 KB
testcase_21 AC 18 ms
8,608 KB
testcase_22 AC 19 ms
8,524 KB
testcase_23 AC 127 ms
23,328 KB
testcase_24 AC 44 ms
13,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N, X = map(int, input().split())
A = tuple(map(int, input().split()))

D = defaultdict(int)

for i in range(N):
    D[A[i]] += 1

res = 0

for k, v in D.items():
    if X - k in D:
        res += D[X - k] * v

print(res)
0