#P6957. Maximal submatrix

    ID: 5814 远端评测题 4000ms 64MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2021“MINIEYE杯”中国大学生算法设计超级联赛(1)

Maximal submatrix

Problem Description

Given a matrix of n rows and m columns,find the largest area submatrix which is non decreasing on each column

Input

The first line contains an integer $T(1 \leq T \leq 10)$representing the number of test cases.
For each test case, the first line contains two integers $n,m(1 \leq n,m \leq2*10^3) $representing the size of the matrix
the next n line followed. the i-th line contains $m$ integers $v_{ij}$$(1 \leq v_{ij} \leq 5*10^3)$representing the value of matrix
It is guaranteed that there are no more than 2 testcases with $n*m>10000$

Output

For each test case, print a integer representing the Maximal submatrix

1 2 3 1 2 4 2 3 3
4