CF375B.Maximum Submatrix 2

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a matrix consisting of digits zero and one, its size is n×mn×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 aa are numbered from 1 to nn from top to bottom and the columns are numbered from 1 to mm from left to right. A matrix cell on the intersection of the ii -th row and the jj -th column can be represented as (i,j)(i,j) . Formally, a submatrix of matrix aa is a group of four integers d,u,l,rd,u,l,r (1<=d<=u<=n; 1<=l<=r<=m)(1<=d<=u<=n; 1<=l<=r<=m) . We will assume that the submatrix contains cells (i,j)(i,j) (d<=i<=u; l<=j<=r)(d<=i<=u; l<=j<=r) . The area of the submatrix is the number of cells it contains.

输入格式

The first line contains two integers nn and mm (1<=n,m<=5000)(1<=n,m<=5000) . Next nn lines contain mm characters each — matrix aa . Matrix aa 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
    
首页