結果

問題 No.723 2つの数の和
ユーザー ysys
提出日時 2018-08-12 10:22:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 11,824 KB
実行使用メモリ 35,772 KB
最終ジャッジ日時 2023-10-24 14:29:32
合計ジャッジ時間 4,529 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
30,916 KB
testcase_01 AC 106 ms
30,916 KB
testcase_02 AC 106 ms
30,916 KB
testcase_03 AC 148 ms
23,260 KB
testcase_04 AC 159 ms
24,380 KB
testcase_05 AC 158 ms
23,804 KB
testcase_06 AC 154 ms
23,712 KB
testcase_07 AC 124 ms
21,356 KB
testcase_08 AC 126 ms
21,768 KB
testcase_09 AC 162 ms
25,084 KB
testcase_10 AC 112 ms
21,696 KB
testcase_11 AC 99 ms
20,440 KB
testcase_12 AC 130 ms
22,884 KB
testcase_13 AC 172 ms
33,100 KB
testcase_14 AC 125 ms
31,328 KB
testcase_15 AC 134 ms
31,724 KB
testcase_16 AC 156 ms
32,328 KB
testcase_17 AC 162 ms
33,480 KB
testcase_18 AC 146 ms
32,720 KB
testcase_19 AC 160 ms
35,772 KB
testcase_20 AC 107 ms
30,916 KB
testcase_21 AC 107 ms
30,916 KB
testcase_22 AC 108 ms
30,916 KB
testcase_23 AC 133 ms
24,832 KB
testcase_24 AC 123 ms
31,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n, x = map(int, input().split())
a = list(map(int, input().split()))
dic = defaultdict(int)

for i in range(n):
    dic[a[i]] += 1

num = 0
for i in range(100005):
    num += dic[i] * dic[x - i]

print(num)
0