結果

問題 No.615 集合に分けよう
ユーザー lemonlemon
提出日時 2021-05-14 15:15:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,516 KB
最終ジャッジ日時 2024-04-09 19:40:18
合計ジャッジ時間 2,659 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 29 ms
10,752 KB
testcase_07 AC 28 ms
10,752 KB
testcase_08 AC 27 ms
10,752 KB
testcase_09 AC 27 ms
10,752 KB
testcase_10 AC 28 ms
10,752 KB
testcase_11 AC 27 ms
10,624 KB
testcase_12 AC 27 ms
10,752 KB
testcase_13 AC 27 ms
10,624 KB
testcase_14 AC 30 ms
10,880 KB
testcase_15 AC 38 ms
12,032 KB
testcase_16 AC 91 ms
16,260 KB
testcase_17 AC 91 ms
16,388 KB
testcase_18 AC 93 ms
16,516 KB
testcase_19 AC 91 ms
16,384 KB
testcase_20 AC 90 ms
16,376 KB
testcase_21 AC 90 ms
16,260 KB
testcase_22 AC 91 ms
16,260 KB
testcase_23 AC 57 ms
13,952 KB
testcase_24 AC 78 ms
16,252 KB
testcase_25 AC 28 ms
10,752 KB
testcase_26 AC 27 ms
10,624 KB
testcase_27 AC 46 ms
11,800 KB
testcase_28 AC 47 ms
11,928 KB
testcase_29 AC 54 ms
16,076 KB
testcase_30 AC 54 ms
16,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 * 9 + 7
inf = 2 << 60

n, k = na()
A = sorted(na())
B = sorted([A[i] - A[i - 1] for i in range(1, n)])

print(sum(B[:n - k]))
0