Rectangular Dry Land

시간 제한7초메모리 제한1024 MB

요약
0은 마른 땅, 1은 습지인 격자가 주어질 때, 모두 0으로만 이루어진 가장 큰 직사각형의 넓이를 구한다.
난이도

보통10점 중 6점

유형
스택, 배열, 동적 계획법
정답자
아직 제출이 없습니다

문제

There are a lot of wetlands in Florida and finding space for building houses is a challenge. This problem is even more serious when people insist their houses to be rectangular shapes.

Let’s assume our land is a two-dimensional (rectangular) grid and each grid cell is either wet or dry. We are interested in finding the largest rectangular dryland, i.e., we want to build the largest house (in area). Note that the house must be dryland in rectangular shape, i.e., the dry cells (area to build the house) must be rectangular and there can’t be any wet cells in that rectangle.

입력

The first input line contains two integers: r (1 ≤ r ≤ 200), indicating the number of rows in our land and c (1 ≤ c ≤ 200), indicating the number of columns in our land. Each of the next r input lines specifies a row in the land; each line contains c characters (starting in column 1), each character being either 1 (wetland) or 0 (dryland).

출력

Print the area of the largest rectangular dryland.

예제3

  1. 예제 1

    입력
    4 5
    10010
    01111
    11110
    00001
    
    예상 출력
    6
    
  2. 예제 2

    입력
    3 2
    10
    11
    11
    
    예상 출력
    4
    
  3. 예제 3

    입력
    2 2
    10
    01
    
    예상 출력
    1