結果
問題 | No.3050 Prefix Removal |
ユーザー |
![]() |
提出日時 | 2025-03-08 04:57:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 435 ms / 2,000 ms |
コード長 | 336 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 82,300 KB |
実行使用メモリ | 201,264 KB |
最終ジャッジ日時 | 2025-03-08 04:57:33 |
合計ジャッジ時間 | 18,177 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
n,k=map(int,input().split()) a=list(map(int,input().split())) for i in range(1,n): a[i]+=a[i-1] X=1<<60 a1=0 a2=0 from heapq import heappush,heappop q=[] for i in range(k-1): heappush(q,-a[i]) a2+=a[i] for i in range(k-1,n): a1=max(a1,a[i]*k-a2) if i>k-1 else a[i]*k-a2 heappush(q,-a[i]) a2+=a[i] a2-=-heappop(q) print(a1)