結果

問題 No.723 2つの数の和
ユーザー sho_00sho_00
提出日時 2020-04-08 22:34:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 215 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 19,796 KB
最終ジャッジ日時 2023-09-26 11:06:36
合計ジャッジ時間 4,230 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,912 KB
testcase_01 AC 16 ms
7,892 KB
testcase_02 AC 15 ms
8,056 KB
testcase_03 AC 99 ms
15,616 KB
testcase_04 AC 182 ms
18,820 KB
testcase_05 AC 164 ms
17,608 KB
testcase_06 AC 134 ms
17,832 KB
testcase_07 AC 56 ms
12,536 KB
testcase_08 AC 66 ms
13,228 KB
testcase_09 AC 114 ms
19,036 KB
testcase_10 AC 78 ms
12,292 KB
testcase_11 AC 24 ms
9,052 KB
testcase_12 AC 69 ms
14,124 KB
testcase_13 AC 191 ms
19,544 KB
testcase_14 AC 52 ms
10,568 KB
testcase_15 AC 82 ms
12,728 KB
testcase_16 AC 117 ms
15,124 KB
testcase_17 AC 155 ms
17,428 KB
testcase_18 AC 144 ms
10,076 KB
testcase_19 AC 168 ms
19,576 KB
testcase_20 AC 16 ms
7,872 KB
testcase_21 AC 15 ms
7,896 KB
testcase_22 AC 16 ms
7,932 KB
testcase_23 AC 180 ms
19,796 KB
testcase_24 AC 61 ms
11,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
  v=x-a[i]
  if v<0:
    pass
  else:
    ans+=bisect.bisect_right(a,v)-bisect.bisect_left(a,v)
print(ans)
0