• [1538] K-Submartix

  • 时间限制: 2000 ms 内存限制: 65535 K
  • 问题描述
  • You are given a matrix consisting of some integer, its size is n*m.
    You should find a minimum area submatrix that the sum of the submatrix (sum of all elements in the submatrix) is not less k.
  • 输入
  • The input contains multiple test cases. Each test case begins with n, m (1 <= n, m <= 250) and k (-10^9 <= k <= 10^9) on line. Next n lines contain m integer each matrix . The input ends once EOF is met.
  • 输出
  • Print a single integer -- the area of the minimum obtained submatrix. If we cannot obtain a matrix of sum is not less k, print -1.
  • 样例输入
  • 4 4 10
    1 2 3 4
    5 6 7 8
    9 10 11 12
    13 14 15 16
    1 3 15
    10 -5 10
    2 2 10
    1 2
    2 3
  • 样例输出
  • 1
    3
    -1
  • 提示
  • 来源
  • wk@NJUPT
  • 操作

显示春菜