結果

問題 No.2694 The Early Bird Catches The Worm
コンテスト
ユーザー M
提出日時 2025-06-19 11:18:59
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 463 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 300 ms
コンパイル使用メモリ 21,536 KB
実行使用メモリ 44,948 KB
最終ジャッジ日時 2026-07-12 07:26:33
合計ジャッジ時間 18,595 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 62
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, h = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

maxv, sat, tired, curr_tired, r = 0, 0, 0, 0, 0

for l in range(n):
    
    while r < n and tired + curr_tired + b[r] <= h:
        curr_tired += b[r]  
        tired += curr_tired
        sat += a[r]  
        r += 1

    maxv = max(maxv, sat)

    if r > l:
        tired -= curr_tired
        curr_tired -= b[l] 
        sat -= a[l]
        
print(maxv)
0