#C2076. Maximum Utility

    ID: 45352 Type: Default 1000ms 256MiB

Maximum Utility

Maximum Utility

You are given a number of test cases. For each test case, you are provided with the number of ingredients \(N\) and the total available time \(M\). Additionally, you are given two lists:

  • A list \(T\) of \(N\) integers, where \(T_i\) represents the time required to prepare one unit of the \(i\)-th ingredient.
  • A list \(U\) of \(N\) integers, where \(U_i\) represents the utility of one unit of the \(i\)-th ingredient.

Your task is to choose one ingredient such that the total utility is maximized. The utility achieved for a chosen ingredient \(i\) is computed using the formula:

$$\text{utility} = \left\lfloor \frac{M}{T_i} \right\rfloor \times U_i$$

Print the maximum utility for each test case.

inputFormat

The input begins with an integer \(C\) representing the number of test cases. Each test case is described with three lines:

  1. The first line contains two integers \(N\) and \(M\) — the number of ingredients and the total available time.
  2. The second line contains \(N\) space-separated integers representing the list \(T\) (time required for one unit of each ingredient).
  3. The third line contains \(N\) space-separated integers representing the list \(U\) (utility of one unit of each ingredient).

outputFormat

For each test case, output a single line containing an integer — the maximum achievable utility.

## sample
4
3 15
2 5 7
10 20 5
2 10
1 10
5 50
3 15
3 8 6
2 10 15
3 0
1 2 3
10 20 30
70

50 30 0

</p>