P28749 [洛谷] [SCOI2015] Play with Matrix
提高+
题目描述

Problem Description

Xiao Tu and Xiao Fang are good friends. Xiao Fang gave Xiao Tu a matrix $A$ of size $n$ × $m$ $(n \leq m)$, and asked Xiao Tu to select $n$ numbers from the matrix such that no two numbers are in the same row or column. Now, Xiao Tu wants to know the minimum value of the $k$-th largest number among the selected $n$ numbers.

Input Format

The first line contains three integers $n, m, k$.

The next $n$ lines each contain $m$ integers, where the $j$-th integer in the $i$-th line represents the element $A_{i,j}$ in the $i$-th row and $j$-th column of the matrix.

Output Format

Output a single line containing the minimum value of the $k$-th largest number among the selected $n$ numbers.

Sample Input and Output

Sample Input #1

2 3 1
1 2 4
2 4 1

Sample Output #1

1

Sample Input #2

3 4 2
1 5 6 6
8 3 4 3
6 8 6 3

Sample Output #2

3

Notes

For $20\%$ of the data, $1 \leq n \leq m \leq 9$

For $40\%$ of the data, $1 \leq n \leq m \leq 22, 1 \leq n \leq 12$

For $100\%$ of the data, $1 \leq k \leq n \leq m \leq 250, 1 \leq A_{i,j} \leq 10^9$

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 3 1 1 2 4 2 4 1
样例输出
1