結果
問題 |
No.2694 The Early Bird Catches The Worm
|
ユーザー |
![]() |
提出日時 | 2024-09-25 16:12:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 175 ms / 2,000 ms |
コード長 | 420 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 133,508 KB |
最終ジャッジ日時 | 2024-09-25 16:12:27 |
合計ジャッジ時間 | 11,041 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 72 |
ソースコード
n,h=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) accB=[0]*(n+1) for i in range(n): accB[i+1]=accB[i]+B[i] 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-=accB[r]-accB[l] satisfied-=A[l] print(ans)