結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー Meso Meso
提出日時 2025-06-19 11:18:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 42,904 KB
最終ジャッジ日時 2025-06-19 11:19:18
合計ジャッジ時間 19,296 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

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