Supermarket
Time limit1sMemory limit128 MB
Find the k-th smallest value among n amounts spent, with values bounded by 100000.
- Level
Easy3 of 10
- Topics
- Sorting, Array, Brute force, Math
- Solved
- No attempts yet
Problem
A supermarket is running a promotion. Throughout the day, each customer spends some amount of money in the store. At the end of the day, the store draws a number and sends a prize to the customer who spent the -th smallest amount that day (counting the amounts from smallest to largest). The amounts spent by customers need not be distinct, but your task is simply to find the value of the -th smallest amount spent that day.
Input
The first line contains the number of test cases ().
The first line of each test contains the number of customers who visited the store that day and the number (; ). The second line contains integers denoting the amounts spent by the customers in order. Each amount is an integer between and , inclusive.
Output
For each test, print the value of the -th smallest amount spent that day, one per line.