Marks :10
: 4 | : 0
You are given an array $$$A$$$ of $$$n$$$ integers. We will add $$$m$$$ elements one by one to the array $$$A$$$. You need to find the sum of $$$k^{th}$$$ largest element in the array $$$A$$$ initially and after each addition.
The first line of input contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of testcases. The description of $$$t$$$ testcases follows.
The first line of each testcase contains three space separated integers $$$n, m (1 \le n,m \le 10^5)$$$ and $$$k$$$ $$$(1 \le k \le n)$$$ — the number of initial elements in array $$$A$$$, the number of elements to be added and the value of $$$k$$$ specified in the statement respectively.
The second line of each testcase contains $$$n$$$ space separated integers $$$a_1, a_2,... a_n$$$ — the initial elements of the array $$$A$$$.
The third line of each testcase contains $$$m$$$ space separated integers $$$b_1, b_2,... b_m$$$ — the elements to be added successively to array $$$A$$$.
For each test case, print a single integer — the sum of $$$k^{th}$$$ largest element in the array $$$A$$$ initially and after adding the $$$m$$$ elements successively.
12 2 21 23 4
6
In the sample test case,
Their sum is $$$1+2+3=6$$$, Hence we output $$$6.$$$
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.