結果
問題 |
No.615 集合に分けよう
|
ユーザー |
![]() |
提出日時 | 2018-03-08 15:01:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 331 bytes |
コンパイル時間 | 184 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 16,100 KB |
最終ジャッジ日時 | 2024-10-05 07:51:45 |
合計ジャッジ時間 | 2,676 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 26 |
ソースコード
import sys ln=list(map(int,input().split())) N=list(map(int,input().split())) rem=[] if ln[1]==1: print(max(N)-min(N)) sys.exit() elif ln[0]==ln[1]: print(0) sys.exit() N.sort() for i in range(0,ln[0]-1): rem.append(N[i+1]-N[i]) rem.sort() ans=0 for i in range(0,ln[0]-ln[1]): ans+=rem[i] print(ans)