#P8088. Minimize Maximum k-th Largest Element
Minimize Maximum k-th Largest Element
Minimize Maximum k-th Largest Element
Given sequences each of length . The -th element of the -th sequence is a positive integer . You are allowed to perform at most swap operations. In each swap, you can choose any two positions and and swap with .
For the -th sequence, let denote its -th largest element. Your task is to minimize ( \max_{1 \le i \le n} d_i ).
Note: Because the input size can be large, it is recommended to use fast input methods. For example, refer to the contest bulletin for details.
inputFormat
The first line contains four space-separated integers , , , and , where is the number of sequences, is the number of elements per sequence, is the order for the k-th largest element, and is the maximum number of swap operations allowed. Each of the next lines contains positive integers representing the sequence .
outputFormat
Output a single integer -- the minimized value of ( \max_{1 \le i \le n} d_i ) that can be achieved after at most swap operations.
sample
2 3 2 1
1 10 5
2 3 8
5