P19254 [CodeChef] VACCINE3
提高-
题目描述

Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well.

Suppose the population is divided into the age groups $[1, 10], [11, 20], [21, 30], \ldots, [91, \infty)$. The age groups are numbered from $1$ to $10$ and there are $X_{i}$ people in age group $i$.

The COVID vaccine drive has started and people will be vaccinated in the decreasing order of their age groups. Suppose $P$ people are vaccinated per day and if less than $P$ people are left in an age group, then the remaining doses for that day are given to the people of immediate lower age group and the process for that day continues until the vaccines for that day are finished or the entire population has been vaccinated. The selection of a person from a given age group is done randomly.

Given $X$, $P$, and Chef’s age group $G$, tell the minimum and the maximum number of days will it take for Chef to get vaccinated.

------ Input ------

The first line contains an integer $T$, the number of test cases. Then the test cases follow.
Each test case contains a single line of input, twelve integers $G$, $P$, $X_{1}, X_{2}, \ldots, X_{10}$.

------ Output ------
For each test case, output in a single line two space-separated integers, the minimum and maximum time required for Chef to get vaccinated.

------ Constraints ------
$1 ≤ T ≤ 10^{4}$
$1 ≤ G ≤ 10$
$1 ≤ P, X_{i} ≤ 10^{5}$

----- Sample Input 1 ------
3

5 2 2 2 2 2 2 2 2 2 2 2

5 2 2 2 2 2 2 3 2 2 2 2

9 4 2 2 2 2 3 2 2 2 2 2
----- Sample Output 1 ------
6 6

6 7

1 1
----- explanation 1 ------
Test Case $1$: It takes one day for every age group to get vaccinated.

Test Case $2$: Age groups $10 - 7$ get vaccinated in a total of $4$ days. On the $5$-th day, $2$ out of $3$ people of age group $6$ get vaccinated. On the $6$-th day, the last person of the $6$-th age group and one random person of the $5$-th age group gets vaccinated. So if the person is Chef, the minimum time required for him to get vaccinated will be $6$ days, and if not, Chef will get vaccinated on the $7$-th day.

Test Case $3$: The last $2$ age groups get vaccinated on the same day.

输入格式

见题面

输出格式

见题面

样例输入
3 5 2 2 2 2 2 2 2 2 2 2 2 5 2 2 2 2 2 2 3 2 2 2 2 9 4 2 2 2 2 3 2 2 2 2 2
样例输出
6 6 6 7 1 1