P20049 [GeeksforGeeks] Reading books3803
普及-
题目描述

Geek is at a book fair. There are total N kinds of books. He has to choose a book of a particular kind and read it loudly as many times as he can in the given time and earn points. Geek knows that reading a book of kind i once needs A_{i} minutes and it will give him B_{i} points. Geek has K minutes for reading books. During this time, he can only read a book of a particular kind as many times as he can so as to maximize his points. But he can not pick books of different kinds, he has to read the same book again and again. Find the maximum points Geek can get.
Example 1:
Input:
N = 3, K = 10
A = {3, 4, 5}
B = {4, 4, 5}
Output: 12
Explaination:
If Geek picks book of first kind he can
read it 3 times, he will get 34 = 12 points.
If Geek picks book of second kind he can
read it 2 times, he will 2
4 = 8 points.
If Geek picks book of third kind he can
read it 2 times, he will get 2*5 = 10 points.
So the maximum possible points which he
can earn in those 10 minutes is 12.
Your Task:
You do not need to read input or print anything. Your task is to complete the function maxPoint() which takes N, K and A and B as input parameters and returns the maximum points Geek can earn.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 10^{5}
1 ≤ K, A_{i}, B_{i} ≤ 10^{9}

输入格式

见题面

输出格式

见题面

样例输入
N = 3, K = 10 A = {3, 4, 5} B = {4, 4, 5}
样例输出
12