题目描述
Problem Description
This problem has a large input size, it is recommended to use fast input methods, which can be referenced from the contest announcement board
Given \( n \) sequences, each sequence contains \( m \) elements, where the \( j \)-th element of the \( i \)-th sequence is a positive integer \( a_{i,j} \).
You can choose \( i_1, j_1 \) and \( i_2, j_2 \) to swap \( a_{i_1, j_1} \) and \( a_{i_2, j_2} \). You are allowed to perform at most \( x \) swaps.
Define \( d_i \) as the \( k \)-th largest element in the \( i \)-th sequence.
Your task is to minimize \( \max\limits_{i=1}^n \{d_i\} \) (the maximum value among \( d_1, d_2, \cdots, d_n \)).
Input Format
The first line contains two positive integers \( n \) and \( m \).
The next \( n \) lines each contain \( m \) positive integers, representing the sequences.
The last line contains two positive integers \( k \) and \( x \).
Output Format
Output a single number, which is the minimized \( \max\limits_{i=1}^n \{d_i\} \).
Sample Input and Output
Sample Input #1
5 5
1 2 3 4 5
6 7 8 9 10
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
2 1
Sample Output #1
8
Sample Input #2
5 5
1 2 3 4 5
6 7 8 9 10
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
2 2
Sample Output #2
7
Sample Input #3
See attachment
Sample Output #3
See attachment
Notes
For the first 30% of the data, \( x = 10^6, 1 \leq k \leq m \).
For the next 10% of the data, all numbers are equal.
For the next 30% of the data, \( 1 \leq n, m \leq 2 \times 10^3, 1 \leq k \leq m, a_{i,j} \leq 10^6, 0 \leq x \leq n \times m \).
For 100% of the data, \( 1 \leq n, m \leq 2 \times 10^3, 1 \leq k \leq m, 1 \leq a_{i,j} \leq 10^{18}, 0 \leq x \leq n \times m \).
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分