結果

問題 No.3760 Streaming Schedule
コンテスト
ユーザー shogo314
提出日時 2026-10-10 00:59:31
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 135 ms / 2,000 ms
+ 952µs
コード長 566 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 242 ms
コンパイル使用メモリ 81,580 KB
実行使用メモリ 137,384 KB
最終ジャッジ日時 2026-10-10 00:59:37
合計ジャッジ時間 5,671 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import deque

N, B, C = map(int, input().split())
A = list(map(int, input().split()))
t = 0
k = 0
d = deque()
e = deque()
for i, a in enumerate(A):
    if d:
        u = e[0] + k
    else:
        u = -(10**18)
    if B > 2 or i == 0:
        u = max(u, t)
    d.append(t - k)
    e.append(t - k)
    while len(e) >= 2 and e[-2] < e[-1]:
        x = e.pop()
        e.pop()
        e.append(x)
    k += a
    while len(d) >= C:
        x = d.popleft()
        if len(e) > 0 and e[0] == x:
            e.popleft()
    t = u
print(max(t, max(d) + k))
0