#874. Half Mixed
Half Mixed
Background
Given two integers and , you need to construct a matrix satisfying the following constraints:
• The number of rows and columns of are and respectively.
• The matrix contains only 0s and 1s, namely,
• The number of mixed subrectangles equal to the number of pure subrectangles. The subrectangles containing both s and s are considered mixed subrectangles, otherwise pristine subrectangles. Note that a subrectangle intersects some consecutive rows and some consecutive columns.
Now contestants have submitted many matrices, you need to check if they are right or not.
Input
The first line contains two integers and , denoting the number of rows and columns respectively.
Then next n lines, each line has m digits denoting the matrix. .
Output
Print integers in one line, denoting the number of mixed subrectangles, pure s subrectangles, pure s subrectangles.
Samples
2 3
0 1 1
1 1 0
9 2 7