結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
mutualns
|
| 提出日時 | 2024-03-23 06:03:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 172 ms / 2,000 ms |
| コード長 | 475 bytes |
| コンパイル時間 | 362 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 132,052 KB |
| 最終ジャッジ日時 | 2024-09-30 13:04:45 |
| 合計ジャッジ時間 | 10,441 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 72 |
ソースコード
n,h=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
r=0
now=0
now2=0
now3=0
cnt=0
for i in range(n):
if i==r:
r+=1
now+=a[i]
now2+=b[i]
now3+=b[i]
cnt=1
for j in range(r,n):
if now2+(cnt+1)*b[j]<=h:
now+=a[j]
now2+=(cnt+1)*b[j]
now3+=b[j]
cnt+=1
r+=1
else:
break
if now2<=h:
ans=max(now,ans)
now-=a[i]
now2-=now3
now3-=b[i]
cnt-=1
print(ans)
mutualns