結果

問題 No.615 集合に分けよう
ユーザー trineutrontrineutron
提出日時 2021-02-23 15:12:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 178 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 11,792 KB
実行使用メモリ 15,796 KB
最終ジャッジ日時 2023-10-23 16:22:13
合計ジャッジ時間 3,787 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,060 KB
testcase_01 AC 31 ms
10,060 KB
testcase_02 AC 31 ms
10,060 KB
testcase_03 AC 31 ms
10,060 KB
testcase_04 AC 31 ms
10,060 KB
testcase_05 AC 31 ms
10,060 KB
testcase_06 AC 30 ms
10,060 KB
testcase_07 AC 32 ms
10,064 KB
testcase_08 AC 32 ms
10,064 KB
testcase_09 AC 33 ms
10,064 KB
testcase_10 AC 31 ms
10,060 KB
testcase_11 AC 30 ms
10,060 KB
testcase_12 AC 31 ms
10,064 KB
testcase_13 AC 31 ms
10,116 KB
testcase_14 AC 32 ms
10,196 KB
testcase_15 AC 43 ms
11,180 KB
testcase_16 AC 98 ms
15,796 KB
testcase_17 AC 98 ms
15,796 KB
testcase_18 AC 93 ms
15,796 KB
testcase_19 AC 97 ms
15,796 KB
testcase_20 AC 99 ms
15,796 KB
testcase_21 AC 96 ms
15,796 KB
testcase_22 AC 101 ms
15,796 KB
testcase_23 AC 58 ms
13,780 KB
testcase_24 AC 79 ms
15,544 KB
testcase_25 AC 30 ms
10,060 KB
testcase_26 AC 32 ms
10,060 KB
testcase_27 AC 46 ms
11,204 KB
testcase_28 AC 45 ms
11,204 KB
testcase_29 AC 54 ms
15,412 KB
testcase_30 AC 55 ms
15,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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