题目描述
Problem Description
Little Z has found a job at a power supply company and has immediately encountered a challenging task.
The city where Little Z works can be seen as an $n \times m$ grid, where the grid at the $i$-th row and $j$-th column has a power demand of $a_{i,j}$. However, the power supply $u$ that the company can provide is less than the total power demand of all grids. Therefore, the company has to divide the city into several regions, each of which will be cut off from power supply alternately, ensuring that the total power demand of the remaining regions does not exceed the power supply the company can provide.
For convenience, the method of dividing regions is straightforward: each time, a large region is divided horizontally or vertically into two smaller regions, and this process is repeated recursively.
The power supply company wants to minimize the dissatisfaction of the citizens, so they need Little Z to calculate the maximum number of regions that can be divided into and, under this premise, the maximum remaining power (the remaining power of a division is the minimum value of the remaining power after each power cut), hoping you can help him.
Input Format
The first line contains three integers $n, m, u$.
The next $n$ lines, each containing $m$ integers, represent the power demand $a_{i,j}$ of the grid at the $i$-th row and $j$-th column, as described in the problem.
Output Format
A single line containing two integers, representing the maximum number of regions that can be divided into and the maximum remaining power under this premise.
Sample Input and Output
Sample Input #1
3 3 33
4 4 2
2 9 6
6 5 3
Sample Output #1
4 1
Sample Input #2
3 4 15
1 2 1 2
2 1 2 1
1 2 1 2
Sample Output #2
6 0
Notes
For $60\%$ of the data, $1 \leq n, m \leq 10$.
For $100\%$ of the data, $1 \leq n, m \leq 32, 1 \leq a_{i,j} \leq 100$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分