結果

問題 No.615 集合に分けよう
ユーザー s_shoheis_shohei
提出日時 2020-05-10 15:45:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 195 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 86,268 KB
最終ジャッジ日時 2023-09-22 02:52:52
合計ジャッジ時間 4,156 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,160 KB
testcase_01 AC 71 ms
71,420 KB
testcase_02 AC 70 ms
71,472 KB
testcase_03 AC 71 ms
71,416 KB
testcase_04 AC 71 ms
71,296 KB
testcase_05 AC 72 ms
71,452 KB
testcase_06 AC 71 ms
71,420 KB
testcase_07 AC 71 ms
71,332 KB
testcase_08 AC 70 ms
71,220 KB
testcase_09 AC 69 ms
71,072 KB
testcase_10 AC 69 ms
71,400 KB
testcase_11 AC 70 ms
71,068 KB
testcase_12 AC 71 ms
71,076 KB
testcase_13 AC 71 ms
71,312 KB
testcase_14 AC 70 ms
71,076 KB
testcase_15 AC 79 ms
76,404 KB
testcase_16 AC 102 ms
85,536 KB
testcase_17 AC 100 ms
85,628 KB
testcase_18 AC 101 ms
86,104 KB
testcase_19 AC 102 ms
86,184 KB
testcase_20 AC 100 ms
86,268 KB
testcase_21 AC 101 ms
85,920 KB
testcase_22 AC 101 ms
85,624 KB
testcase_23 AC 88 ms
84,556 KB
testcase_24 AC 102 ms
85,632 KB
testcase_25 AC 69 ms
71,284 KB
testcase_26 AC 70 ms
71,264 KB
testcase_27 AC 82 ms
83,600 KB
testcase_28 AC 84 ms
83,808 KB
testcase_29 AC 87 ms
85,104 KB
testcase_30 AC 88 ms
85,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
d=[]
for i in range(n-1):
    d.append(a[i+1]-a[i])
d.sort()
if k==1:
    print(sum(d))
else:
    print(sum(d[:-k+1]))
0