Math, asked by RahulChikku29, 11 months ago

rahul and ankit are the only two waiters in royal restaurant. today, the restaurant received n orders. the amount of tips may differ when handled by different waiters, if rahul takes the ith order, he would be tipped ai rupees and if ankit takes this order, the tip would be bi rupees.


lublana: Incomplete question

Answers

Answered by Shaizakincsem
19

Here is the complete question:

Rahul and Ankit are the only two waiters in Royal Restaurant. Today, the restaurant received N orders. The amount of tips may differ when handled by different waiters, if Rahul takes the ith order, he would be tipped Ai rupees and if Ankit takes this order, the tip would be Bi rupees.

In order to maximize the total tip value they decided to distribute the order among themselves. One order will be handled by one person only. Also, due to time constraints Rahul cannot take more than X orders and Ankit cannot take more than Y orders. It is guaranteed that X + Y is greater than or equal to N, which means that all the orders can be handled by either Rahul or Ankit. Find out the maximum possible amount of total tip money after processing all the orders.

Input:

In the first line there is only one integer

In the second line there are three integers; which are NXY

In the third line there are N integers which consists of ith integer which is the representation of A.

And in the fourth line there are also N integers the ith integer is the representation of B.

Output:

Now the single integer would be printed which will represent the maximum tip money which would be received by them.

Constraints:

1 ≤ Ai, Bi ≤ 104

1 ≤ X, Y ≤ N; X + Y ≥ N

1 ≤ N ≤ 105

Example:

Input:

2

5 3 3

1 2 3 4 5

5 4 3 2 1

8 4 4

1 4 3 2 7 5 9 6  

1 2 3 6 5 4 9 8

Output:

21

43

Answered by sivaramakrishnans201
0

vabama. ab

Shana

ababa

Similar questions