結果
| 問題 |
No.2548 Problem Selection
|
| コンテスト | |
| ユーザー |
sepa38
|
| 提出日時 | 2023-11-18 00:28:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 263 bytes |
| コンパイル時間 | 203 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 86,656 KB |
| 最終ジャッジ日時 | 2024-09-26 05:35:48 |
| 合計ジャッジ時間 | 3,471 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
n, m = map(int, input().split()) a = sorted(list(map(int, input().split()))) now = 0 for i in range(m-1): now += (a[i+1] - a[i]) ** 2 ans = now for i in range(n-m): now -= (a[i+1] - a[i]) ** 2 now += (a[i+m] - a[i+m-1]) ** 2 ans = min(ans, now) print(ans)
sepa38