AmazonOA #152
Find Kth Minimum Vulnerability
估计困难可在线判题
For each contiguous window of length m in the array, sort it in ascending order and take the k-th value. Repeated values each take their own position, and the answers are output in ascending order of window start.
输入格式
The first line contains n m k (1≤k≤m≤n≤300000), and the second line contains n vulnerability values (1..10^9).
输出格式
Output the k-th smallest values of the n−m+1 windows.
样例 1
输入:
4 3 2
1 3 2 1
输出:
2 2
样例 2
输入:
5 4 3
4 2 3 1 1
输出:
3 2
样例 3
输入:
3 2 2
5 5 1
输出:
5 5
样例说明
Example 1: both windows sort to 1, 2, 3, and the 2nd item is 2 in both. Example 2: the windows sort to 1, 2, 3, 4 and 1, 1, 2, 3, so the 3rd items are 3 and 2 respectively. Example 3: the repeated 5s each take a position, so the 2nd smallest of both windows is 5.