K-th Number

TimeLimit:1000MS  MemoryLimit:262144KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Alice are given an array $A[1..N]$ with $N$ numbers.

Now Alice want to build an array $B$ by a parameter $K$ as following rules:

Initially, the array B is empty. Consider each interval in array A. If the length of this interval is less than $K$, then ignore this interval. Otherwise, find the $K$-th largest number in this interval and add this number into array $B$.

In fact Alice doesn't care each element in the array B. She only wants to know the $M$-th largest element in the array $B$. Please help her to find this number.
Input
The first line is the number of test cases.

For each test case, the first line contains three positive numbers $N(1 \leq N \leq 10^5), K(1 \leq K \leq N), M$. The second line contains $N$ numbers $A_i (1 \leq A_i \leq 10^9)$.

It's guaranteed that M is not greater than the length of the array B.
Output
For each test case, output a single line containing the $M$-th largest element in the array $B$.
SampleInput
2
5 3 2
2 3 1 5 4
3 3 1
5 8 2
SampleOutput
3
2
Submit
题目统计信息详细
总AC数7
通过人数6
尝试人数6
总提交量16
AC率37.50%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: