結果

問題 No.615 集合に分けよう
ユーザー pluto77pluto77
提出日時 2017-12-22 17:23:09
言語 Python2
(2.7.18)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 6,488 KB
実行使用メモリ 11,108 KB
最終ジャッジ日時 2023-08-22 21:19:33
合計ジャッジ時間 3,459 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,844 KB
testcase_01 AC 11 ms
5,908 KB
testcase_02 AC 11 ms
5,912 KB
testcase_03 AC 11 ms
5,832 KB
testcase_04 AC 12 ms
5,956 KB
testcase_05 AC 11 ms
6,028 KB
testcase_06 AC 11 ms
6,124 KB
testcase_07 AC 12 ms
6,064 KB
testcase_08 AC 12 ms
5,844 KB
testcase_09 AC 12 ms
6,056 KB
testcase_10 AC 11 ms
6,056 KB
testcase_11 AC 11 ms
5,836 KB
testcase_12 AC 12 ms
5,948 KB
testcase_13 AC 11 ms
5,884 KB
testcase_14 AC 13 ms
6,096 KB
testcase_15 AC 25 ms
6,748 KB
testcase_16 AC 93 ms
10,720 KB
testcase_17 AC 87 ms
10,560 KB
testcase_18 AC 87 ms
10,688 KB
testcase_19 AC 88 ms
10,564 KB
testcase_20 AC 89 ms
10,560 KB
testcase_21 AC 90 ms
10,608 KB
testcase_22 AC 93 ms
10,604 KB
testcase_23 AC 56 ms
8,876 KB
testcase_24 AC 87 ms
10,128 KB
testcase_25 AC 11 ms
6,012 KB
testcase_26 AC 11 ms
5,836 KB
testcase_27 AC 43 ms
7,512 KB
testcase_28 AC 43 ms
7,384 KB
testcase_29 AC 51 ms
11,108 KB
testcase_30 AC 51 ms
10,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_615

n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
a1=sorted(a)
b=[]
for i in xrange(1,n):
 b.append(a1[i]-a1[i-1])
b1=sorted(b,reverse=True)
res=sum(b1)
for i in xrange(k-1):
 res-=b1[i]
print res
0