結果
問題 | No.2548 Problem Selection |
ユーザー |
👑 |
提出日時 | 2023-11-25 16:08:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 255 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,504 KB |
最終ジャッジ日時 | 2024-09-26 10:54:42 |
合計ジャッジ時間 | 3,115 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 WA * 5 |
ソースコード
n, m = [int(x) for x in input().split()] a = [int(x) for x in input().split()] a.sort() d = [] for i in range(1, n): d.append((a[i] - a[i-1]) ** 2) ans = 10 ** 19 s = sum(d[:m-1]) for i in range(n - m): s += d[i+m-1] - d[i] ans = min(s, ans) print(ans)