結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー るこーそー
提出日時 2024-09-25 16:11:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 132,132 KB
最終ジャッジ日時 2024-09-25 16:11:51
合計ジャッジ時間 11,309 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15 WA * 57
権限があれば一括ダウンロードができます

ソースコード

diff #

n,h=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

ans=0
r=0
tired=0
satisfied=0
for l in range(n):
    while r<n and tired+(r-l+1)*B[r]<=h:
        tired+=(r-l+1)*B[r]
        satisfied+=A[r]
        r+=1
        
    ans=max(ans,satisfied)
    tired-=(r-l)*B[l]
    satisfied-=A[l]
    
print(ans)
    
0