結果

問題 No.615 集合に分けよう
ユーザー RyutoRyuto
提出日時 2017-12-16 00:55:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 81,652 KB
最終ジャッジ日時 2023-08-21 07:15:00
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,332 KB
testcase_01 AC 71 ms
71,172 KB
testcase_02 AC 71 ms
71,400 KB
testcase_03 AC 71 ms
71,272 KB
testcase_04 AC 73 ms
71,448 KB
testcase_05 AC 72 ms
71,272 KB
testcase_06 AC 73 ms
71,372 KB
testcase_07 AC 73 ms
71,452 KB
testcase_08 AC 73 ms
71,040 KB
testcase_09 AC 73 ms
71,036 KB
testcase_10 AC 74 ms
71,348 KB
testcase_11 AC 74 ms
71,256 KB
testcase_12 AC 74 ms
71,100 KB
testcase_13 AC 74 ms
71,100 KB
testcase_14 AC 74 ms
71,172 KB
testcase_15 AC 82 ms
75,856 KB
testcase_16 AC 101 ms
81,156 KB
testcase_17 AC 103 ms
81,440 KB
testcase_18 AC 103 ms
81,376 KB
testcase_19 AC 103 ms
81,652 KB
testcase_20 AC 102 ms
81,412 KB
testcase_21 AC 102 ms
81,224 KB
testcase_22 AC 101 ms
81,120 KB
testcase_23 AC 91 ms
79,920 KB
testcase_24 AC 103 ms
81,040 KB
testcase_25 AC 75 ms
71,264 KB
testcase_26 AC 73 ms
71,172 KB
testcase_27 AC 84 ms
79,308 KB
testcase_28 AC 84 ms
79,308 KB
testcase_29 AC 87 ms
80,984 KB
testcase_30 AC 88 ms
81,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

indat = [int(x) for x in input().split()]
innums = [int(x) for x in input().split()]
innums.sort()

diffl = [innums[i+1]-innums[i] for i in range(indat[0]-1)]
diffl.sort(reverse=True)

ans = sum(diffl[indat[1]-1:])
print(ans)
0