F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

K-th Number

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 5040    Accepted Submission(s): 1889


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$.
 

Sample Input
2 5 3 2 2 3 1 5 4 3 3 1 5 8 2
 

Sample Output
3 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 10:01:15, Gzip enabled