結果
問題 |
No.3050 Prefix Removal
|
ユーザー |
![]() |
提出日時 | 2025-03-07 21:30:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 333 ms / 2,000 ms |
コード長 | 344 bytes |
コンパイル時間 | 929 ms |
コンパイル使用メモリ | 81,932 KB |
実行使用メモリ | 143,964 KB |
最終ジャッジ日時 | 2025-03-07 21:30:56 |
合計ジャッジ時間 | 13,368 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
from heapq import heappushpop, heappush from itertools import accumulate n, k = map(int, input().split()) ans = -10 ** 20 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)