結果
| 問題 | No.615 集合に分けよう |
| コンテスト | |
| ユーザー |
kwnwsdnc
|
| 提出日時 | 2018-03-08 14:57:47 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 344 bytes |
| 記録 | |
| コンパイル時間 | 335 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 26,192 KB |
| 最終ジャッジ日時 | 2026-04-20 21:23:02 |
| 合計ジャッジ時間 | 6,202 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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