KLARGE - Kth Largest Candy Packet

no tags 

Vardh has a bag which contains "n" packets in it. Each packet has "li" candies in it. Vardh wants to find out the packet which has the kth largest number of candies in it. Some chocolate packets can have the same number of chocolates in them.

Input:
The first line of the test case contains an integer t(1 <= t <= 10), the number of test cases. Then t test cases follow.
First line of each test case contains the integer n(1 <= n <= 10^6) denoting the number of packets in the bag.
The following line contains n integers(0 <= li <= 10^6), separated by a single space, denoting the number of candies in each packet.
The last line of each test case contains the integer "k".(1 <= k <= n).

Output:
Print a line for each test case denoting the no of candies in the kth largest candy packet corresponding to the given input.

Example:
Input:
1
4
1 2 6 4
3
Output:
2

Explanation:
There are 4 packets and we have to find the no of candies in the third largest bag.
The largest packet contains 6 candies, second largest has 4 candies and the third largest has 2 candies in it, hence the output is "2".

NOTE:
There will be multiple test cases for this problem and the score you receive is relative to the number of test cases your code passes. A score of 0 indicates that your code doesn't work properly for any of the test cases and a score of 100 indicates that your code works for all test cases.



Added by:kousik
Date:2013-08-29
Time limit:0.200s-0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP JAVA PYTHON PYTHON3 PY_NBC RUBY TEXT
Resource:Own