結果
問題 |
No.3050 Prefix Removal
|
ユーザー |
![]() |
提出日時 | 2025-03-07 21:29:55 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 344 bytes |
コンパイル時間 | 612 ms |
コンパイル使用メモリ | 82,516 KB |
実行使用メモリ | 144,384 KB |
最終ジャッジ日時 | 2025-03-07 21:30:10 |
合計ジャッジ時間 | 13,795 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 53 WA * 2 |
ソースコード
from heapq import heappushpop, heappush from itertools import accumulate n, k = map(int, input().split()) ans = -10 ** 18 h = [] now = 0 for x in accumulate(map(int, input().split())): if len(h) == k - 1: ans = max(ans, k * x - now) now += x + heappushpop(h, -x) else: now += x heappush(h, -x) print(ans)