Maximum Submatrix 2
题意翻译
题目描述:
给你一个0、1组成的矩阵,大小为 n × m ,你可以把任意的两行的位置相互交换,请你给出变换后能得到的最大子矩阵,满足只由“1”组成。
输入:
第一行给出两个整数 n 和 m (1 ≤ n, m ≤ 5000)。
接下来 n 行每行给出两个给出一个矩阵a,仅有0、1组成,中间没有间隔。
输出:
输出一行一个整数,表示最大子矩阵满足只由“1”组成的大小,无答案输出0。
题目描述
You are given a matrix consisting of digits zero and one, its size is $ n×m $ . You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?
Let's assume that the rows of matrix $ a $ are numbered from 1 to $ n $ from top to bottom and the columns are numbered from 1 to $ m $ from left to right. A matrix cell on the intersection of the $ i $ -th row and the $ j $ -th column can be represented as $ (i,j) $ . Formally, a submatrix of matrix $ a $ is a group of four integers $ d,u,l,r $ $ (1<=d<=u<=n; 1<=l<=r<=m) $ . We will assume that the submatrix contains cells $ (i,j) $ $ (d<=i<=u; l<=j<=r) $ . The area of the submatrix is the number of cells it contains.
输入输出格式
输入格式
The first line contains two integers $ n $ and $ m $ $ (1<=n,m<=5000) $ . Next $ n $ lines contain $ m $ characters each — matrix $ a $ . Matrix $ a $ only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines.
输出格式
Print a single integer — the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0.
输入输出样例
输入样例 #1
1 1
1
输出样例 #1
1
输入样例 #2
2 2
10
11
输出样例 #2
2
输入样例 #3
4 3
100
011
000
101
输出样例 #3
2