結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2024-03-23 04:04:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 170 ms / 2,000 ms |
| コード長 | 629 bytes |
| コンパイル時間 | 219 ms |
| コンパイル使用メモリ | 81,664 KB |
| 実行使用メモリ | 133,356 KB |
| 最終ジャッジ日時 | 2024-09-30 13:02:21 |
| 合計ジャッジ時間 | 10,387 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())) rui=[0]*(n+1) for i in range(n): rui[i+1]=rui[i]+b[i] right = 0 now_manzoku = 0 now_hirou = 0 ans = 0 for left in range(n): while right<n: if right<left: now_hirou+=(right-left+1)*b[right] now_manzoku+=a[right] right+=1 continue if now_hirou>h:break now_hirou+=(right-left+1)*b[right] now_manzoku+=a[right] right+=1 if now_hirou>h: right-=1 now_manzoku-=a[right] now_hirou-=(right-left+1)*b[right] break ans=max(ans,now_manzoku) now_manzoku-=a[left] now_hirou-=rui[right]-rui[left] print(ans)
shobonvip