結果

問題 No.615 集合に分けよう
ユーザー MaboyMaboy
提出日時 2018-03-06 18:17:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 134 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 11,764 KB
実行使用メモリ 15,836 KB
最終ジャッジ日時 2023-10-19 23:29:26
合計ジャッジ時間 2,892 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,096 KB
testcase_01 AC 30 ms
10,096 KB
testcase_02 AC 30 ms
10,096 KB
testcase_03 AC 31 ms
10,096 KB
testcase_04 AC 30 ms
10,096 KB
testcase_05 AC 30 ms
10,096 KB
testcase_06 AC 30 ms
10,096 KB
testcase_07 AC 31 ms
10,100 KB
testcase_08 AC 30 ms
10,100 KB
testcase_09 AC 31 ms
10,100 KB
testcase_10 AC 30 ms
10,096 KB
testcase_11 AC 30 ms
10,096 KB
testcase_12 AC 30 ms
10,100 KB
testcase_13 AC 31 ms
10,160 KB
testcase_14 AC 31 ms
10,236 KB
testcase_15 AC 41 ms
11,280 KB
testcase_16 AC 90 ms
15,704 KB
testcase_17 AC 91 ms
15,704 KB
testcase_18 AC 91 ms
15,704 KB
testcase_19 AC 91 ms
15,704 KB
testcase_20 AC 92 ms
15,704 KB
testcase_21 AC 90 ms
15,836 KB
testcase_22 AC 92 ms
15,704 KB
testcase_23 AC 56 ms
13,816 KB
testcase_24 AC 79 ms
15,556 KB
testcase_25 AC 30 ms
10,096 KB
testcase_26 AC 30 ms
10,096 KB
testcase_27 AC 45 ms
11,244 KB
testcase_28 AC 45 ms
11,244 KB
testcase_29 AC 55 ms
15,448 KB
testcase_30 AC 54 ms
15,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(sorted(map(int,input().split())))
print(sum(sorted([a[i]-a[i-1] for i in range(1,len(a))])[:n-k]))
0