Codeforces Round 211 (Div. 2)
D
Renting Bikes
Codeforces
1800
原题
← CE →
翻译中…

A group of $*n*$ schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them.

翻译中…

The renting site offered them $*m*$ bikes. The renting price is different for different bikes, renting the $*j*$-th bike costs $*p*_{*j*}$ rubles.

翻译中…

In total, the boys' shared budget is $*a*$ rubles. Besides, each of them has his own personal money, the $*i*$-th boy has $*b*_{*i*}$ personal rubles. The shared budget can be spent on any schoolchildren arbitrarily, but each boy's personal money can be spent on renting only this boy's bike.

翻译中…

Each boy can rent at most one bike, one cannot give his bike to somebody else.

翻译中…

What maximum number of schoolboys will be able to ride bikes? What minimum sum of personal money will they have to spend in total to let as many schoolchildren ride bikes as possible?

翻译中…

Input

翻译中…

The first line of the input contains three integers $*n*$, $*m*$ and $*a*$ ($1 ≤ *n*, *m* ≤ 10^{5}$; $0 ≤ *a* ≤ 10^{9}$). The second line contains the sequence of integers $*b*_{1}, *b*_{2}, ..., *b*_{*n*}$ ($1 ≤ *b*_{*i*} ≤ 10^{4}$), where $*b*_{*i*}$ is the amount of the $*i*$-th boy's personal money. The third line contains the sequence of integers $*p*_{1}, *p*_{2}, ..., *p*_{*m*}$ ($1 ≤ *p*_{*j*} ≤ 10^{9}$), where $*p*_{*j*}$ is the price for renting the $*j*$-th bike.

翻译中…

Output

翻译中…

Print two integers $*r*$ and $*s*$, where $*r*$ is the maximum number of schoolboys that can rent a bike and $*s*$ is the minimum total personal money needed to rent $*r*$ bikes. If the schoolchildren cannot rent any bikes, then $*r* = *s* = 0$.

翻译中…

Note

翻译中…

In the first sample both schoolchildren can rent a bike. For instance, they can split the shared budget in half (5 rubles each). In this case one of them will have to pay 1 ruble from the personal money and the other one will have to pay 2 rubles from the personal money. In total, they spend 3 rubles of their personal money. This way of distribution of money minimizes the amount of spent personal money.

翻译中…

样例

Input #1
2 2 10
5 5
7 6
Output #1
2 3
InputCopy OutputCopy
Input #2
4 5 2
8 1 1 2
6 3 7 5 2
Output #2
3 8
InputCopy OutputCopy
题目信息
题号
363D
时间限制
1 s
内存限制
256 MB
标签
二分
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。