結果

問題 No.615 集合に分けよう
ユーザー AEnAEn
提出日時 2022-05-13 14:56:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 200 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 85,784 KB
最終ジャッジ日時 2023-09-28 19:01:24
合計ジャッジ時間 5,131 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,240 KB
testcase_01 AC 77 ms
71,136 KB
testcase_02 AC 77 ms
71,224 KB
testcase_03 AC 77 ms
70,904 KB
testcase_04 AC 76 ms
71,048 KB
testcase_05 AC 77 ms
71,112 KB
testcase_06 AC 77 ms
71,196 KB
testcase_07 AC 76 ms
71,256 KB
testcase_08 AC 77 ms
71,136 KB
testcase_09 AC 79 ms
71,048 KB
testcase_10 AC 76 ms
71,224 KB
testcase_11 AC 77 ms
71,196 KB
testcase_12 AC 77 ms
71,052 KB
testcase_13 AC 77 ms
71,284 KB
testcase_14 AC 79 ms
70,904 KB
testcase_15 AC 87 ms
75,984 KB
testcase_16 AC 111 ms
85,468 KB
testcase_17 AC 113 ms
85,408 KB
testcase_18 AC 112 ms
85,784 KB
testcase_19 AC 112 ms
85,372 KB
testcase_20 AC 111 ms
85,456 KB
testcase_21 AC 112 ms
85,364 KB
testcase_22 AC 111 ms
85,304 KB
testcase_23 AC 98 ms
84,340 KB
testcase_24 AC 110 ms
85,432 KB
testcase_25 AC 79 ms
70,924 KB
testcase_26 AC 77 ms
71,128 KB
testcase_27 AC 91 ms
83,648 KB
testcase_28 AC 93 ms
83,400 KB
testcase_29 AC 97 ms
85,360 KB
testcase_30 AC 98 ms
85,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
sa = []
for i in range(N-1):
    sa.append(A[i+1]-A[i])
sa.sort()
res = 0
for i in range(N-K):
    res += sa[i]
print(res)
0