結果
問題 | No.2548 Problem Selection |
ユーザー |
![]() |
提出日時 | 2023-11-28 07:48:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 226 ms / 2,000 ms |
コード長 | 262 bytes |
コンパイル時間 | 917 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,508 KB |
最終ジャッジ日時 | 2024-09-26 12:50:45 |
合計ジャッジ時間 | 4,569 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
N,M=map(int,input().split()) A=list(map(int,input().split())) A.sort() score=0 for i in range(1,M): score+=(A[i]-A[i-1])**2 LANS=score for i in range(M,N): score+=(A[i]-A[i-1])**2 score-=(A[i-M+1]-A[i-M])**2 LANS=min(LANS,score) print(LANS)