結果

問題 No.723 2つの数の和
ユーザー Konton7Konton7
提出日時 2019-05-23 16:07:31
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,832 KB
実行使用メモリ 21,768 KB
最終ジャッジ日時 2023-10-17 11:29:57
合計ジャッジ時間 4,628 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,140 KB
testcase_01 AC 30 ms
10,140 KB
testcase_02 AC 29 ms
10,140 KB
testcase_03 AC 175 ms
17,708 KB
testcase_04 AC 226 ms
21,488 KB
testcase_05 AC 201 ms
19,696 KB
testcase_06 AC 218 ms
19,832 KB
testcase_07 AC 107 ms
14,212 KB
testcase_08 AC 118 ms
15,244 KB
testcase_09 AC 230 ms
21,768 KB
testcase_10 AC 105 ms
14,320 KB
testcase_11 AC 45 ms
11,060 KB
testcase_12 AC 135 ms
16,060 KB
testcase_13 AC 235 ms
21,588 KB
testcase_14 AC 75 ms
12,756 KB
testcase_15 AC 110 ms
14,596 KB
testcase_16 AC 153 ms
17,000 KB
testcase_17 AC 197 ms
19,764 KB
testcase_18 AC 188 ms
11,944 KB
testcase_19 AC 206 ms
21,672 KB
testcase_20 AC 30 ms
10,140 KB
testcase_21 AC 30 ms
10,140 KB
testcase_22 AC 30 ms
10,140 KB
testcase_23 AC 214 ms
21,644 KB
testcase_24 AC 86 ms
13,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect



n, x = [ int(v) for v in input().split() ]

num = sorted([ int(v) for v in input().split() ])

s = 0
for i in range(n):
	a = (bisect.bisect_left(num,x-num[i]))
	b = (bisect.bisect_right(num,x-num[i]))
	s += b - a
print(s)
0