atcoder#ABC234D. [ABC234D] Prefix K-th Max
[ABC234D] Prefix K-th Max
Score : points
Problem Statement
Given are a permutation of and a positive integer .
For each , find the following.
- The -th greatest value among the first terms of .
Constraints
- is a permutation of .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
For each , in this order, print the specified value in Problem Statement, separated by newlines.
3 2
1 2 3
1
2
- The -nd greatest value among the first terms of , , is .
- The -nd greatest value among the first terms of , , is .
11 5
3 7 2 5 11 6 1 9 8 10 4
2
3
3
5
6
7
7