Vasya and matrix
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Mother gave Vasya a rectangular matrix n by m. Each cell of the matrix contains one integer. Vasya played a lot of math games with it: he found its determinant and powered it into some degrees.
But such games made him a little tired, so he invented a new entertainment: he chooses an integer k and tries to find a submatrix of maximal area with total sum of numbers in it not greater than k. The submatrix is a rectangular area of matrix.
Input
The first line contains three integers n, m and k (1 ≤ n, m ≤ 300, 1 ≤ k ≤ 10^9
).
Each of the next n lines contains m nonnegative integers, each no more than 1000.
Output
Print the area of maximal submatrix, which sum of numbers is not greater than k.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 435
Acceptance rate 39%