結果
| 問題 |
No.2548 Problem Selection
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-25 15:19:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 217 bytes |
| コンパイル時間 | 325 ms |
| コンパイル使用メモリ | 82,292 KB |
| 実行使用メモリ | 85,888 KB |
| 最終ジャッジ日時 | 2024-12-20 19:48:54 |
| 合計ジャッジ時間 | 3,923 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
n,m=map(int,input().split()) a=list(map(int,input().split())) a.sort() x=0 for i in range(1,m): x+=(a[i]-a[i-1])**2 res=x for i in range(m,n): x+=(a[i]-a[i-1])**2 x-=(a[i-m+1]-a[i-m])**2 res=min(res,x) print(res)