結果
| 問題 |
No.615 集合に分けよう
|
| コンテスト | |
| ユーザー |
kwnwsdnc
|
| 提出日時 | 2018-03-08 14:57:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 344 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 17,700 KB |
| 最終ジャッジ日時 | 2024-10-05 07:50:45 |
| 合計ジャッジ時間 | 4,460 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 13 TLE * 1 -- * 12 |
ソースコード
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])
ans=0
for i in range(0,ln[0]-ln[1]):
n=min(rem)
ans+=n
rem.remove(n)
print(ans)
kwnwsdnc