結果
| 問題 |
No.615 集合に分けよう
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-03-18 19:34:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 2,000 ms |
| コード長 | 202 bytes |
| コンパイル時間 | 438 ms |
| コンパイル使用メモリ | 82,168 KB |
| 実行使用メモリ | 79,772 KB |
| 最終ジャッジ日時 | 2025-03-18 19:34:39 |
| 合計ジャッジ時間 | 3,849 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 26 |
ソースコード
from itertools import pairwise
N, K = map(int, input().split())
A = list(map(int, input().split()))
bs = []
for a, b in pairwise(sorted(A)):
bs.append(b-a)
ans = sum(sorted(bs)[:N-K])
print(ans)
norioc