There are $$$N$$$ packages available for delivery, and you want to deliver as many of them as possible given a limited budget.
You can book a single-night courier run, but you must declare exactly how many packages $$$K$$$ will be delivered in that run. Since it's peak season, besides the basic cost for each package, the company charges a congestion surcharge. More specifically, each package $$$i$$$ has a basic cost $$$a_i$$$ and a congestion coefficient $$$b_i$$$. The cost to deliver package $$$i$$$ in a run of $$$K$$$ packages is $$$a_i + K \cdot b_i$$$.
Given a limited budget $$$B$$$, you want to maximize the number of packages delivered.
The first line contains two integers $$$N$$$ ($$$1 \leq N \leq 2 \cdot 10^5$$$) and $$$B$$$ ($$$0 \leq B \leq 10^9$$$) — the number of packages and the budget respectively. The second line contains $$$N$$$ space separated integers $$$a_1, a_2, \ldots, a_N$$$ ($$$0 \leq a_i \leq 10^5$$$) — the basic costs for each package. The third line contains $$$N$$$ space separated integers $$$b_1, b_2, \ldots, a_N$$$ ($$$0 \leq b_i \leq 10^5$$$) — the congestion coefficients for each package.
Output two integers — the maximum number of packages that can be delivered within budget and the minimum cost to deliver this number of packages.
4 101 2 2 12 2 2 2
2 10
5 353 2 1 4 53 4 5 2 1
3 30
| Название |
|---|


