結果

問題 No.615 集合に分けよう
ユーザー zimphazimpha
提出日時 2017-12-15 00:05:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 202 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 83,836 KB
最終ジャッジ日時 2023-08-21 04:59:12
合計ジャッジ時間 4,356 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,136 KB
testcase_01 AC 66 ms
71,428 KB
testcase_02 AC 67 ms
71,304 KB
testcase_03 AC 66 ms
71,264 KB
testcase_04 AC 66 ms
71,360 KB
testcase_05 AC 67 ms
71,364 KB
testcase_06 AC 66 ms
71,620 KB
testcase_07 AC 65 ms
71,356 KB
testcase_08 AC 66 ms
71,320 KB
testcase_09 AC 67 ms
71,120 KB
testcase_10 AC 66 ms
71,436 KB
testcase_11 AC 65 ms
71,564 KB
testcase_12 AC 69 ms
71,312 KB
testcase_13 AC 69 ms
71,504 KB
testcase_14 AC 68 ms
71,632 KB
testcase_15 AC 75 ms
75,900 KB
testcase_16 AC 98 ms
83,628 KB
testcase_17 AC 97 ms
83,244 KB
testcase_18 AC 97 ms
83,328 KB
testcase_19 AC 97 ms
83,468 KB
testcase_20 AC 95 ms
83,592 KB
testcase_21 AC 96 ms
83,764 KB
testcase_22 AC 96 ms
83,836 KB
testcase_23 AC 84 ms
81,864 KB
testcase_24 AC 95 ms
83,076 KB
testcase_25 AC 65 ms
71,248 KB
testcase_26 AC 68 ms
71,660 KB
testcase_27 AC 78 ms
81,356 KB
testcase_28 AC 78 ms
81,416 KB
testcase_29 AC 79 ms
83,288 KB
testcase_30 AC 85 ms
83,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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