結果

問題 No.2548 Problem Selection
ユーザー lloyz
提出日時 2023-11-27 00:14:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 247 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 92,288 KB
最終ジャッジ日時 2024-09-26 12:00:35
合計ジャッジ時間 3,294 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

n, m = map(int, input().split())
A = list(map(int, input().split()))

A.sort()
D = []
for i in range(1, n):
    D.append(A[i] - A[i - 1])
D.sort()
ans = 0
for i in range(m - 1):
    ans += D[i]**2
print(ans)
0