結果
| 問題 | No.2548 Problem Selection |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-25 16:11:05 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 201 ms / 2,000 ms |
| コード長 | 248 bytes |
| 記録 | |
| コンパイル時間 | 540 ms |
| コンパイル使用メモリ | 20,704 KB |
| 実行使用メモリ | 25,180 KB |
| 最終ジャッジ日時 | 2026-04-13 13:47:53 |
| 合計ジャッジ時間 | 5,332 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
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) s = sum(d[:m-1]) ans = s for i in range(n - m): s += d[i+m-1] - d[i] ans = min(s, ans) print(ans)