SP374 MATRIX - Count maximum matrices
Description
You are given a matrix A of M rows and N columns, consisting of numbers 0 and 1. For a rectangle in A (sides >= 1), X1 is the number of ones on its sides, X0 is the number of zeros on its sides, and its _value_ is defined as X1 – X0. Let us consider W, the maximum value taken over submatrices of A, and S, the number of submatrices with value W. Your task is to find W and S.
Input Format
The first line of input contains the number of testcases t (t
Output Format
For each testcase, you should output a single line with numbers W and S.