시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 161 58 33 40.244%

문제

0과 1로 이루어진 N * M 행렬이 주어졌을 때, 1로 이루어진 가장 큰 직사각형을 찾는 프로그램을 작성하시오. 직사각형은 전체가 1로 가득 차있어야 한다. 또한, 열을 순서를 바꿀 수 있다.

입력

첫째 줄에 N과 M이 주어진다. 둘째 줄부터 N개의 줄에는 행렬이 주어진다.

1 ≤ N ≤ 15000

1 ≤ M ≤ 1500

출력

첫째 줄에 가장 큰 직사각형의 넓이를 출력한다.

예제 입력 1

10 6
001010
111110
011110
111110
011110
111111
110111
110111
000101
010101

예제 출력 1

21

힌트

열의 순서를 적절히 바꿔, 2열, 4열, 5열이 서로 붙어있게 놓는다면, 크기가 21인 직사각형을 얻을 수 있다. (2행~8행 * 2,4,5열)

W3sicHJvYmxlbV9pZCI6IjMzMjEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjMDBcdWM3YTUgXHVkMDcwIFx1YzljMVx1YzBhY1x1YWMwMVx1ZDYxNSIsImRlc2NyaXB0aW9uIjoiPHA+XHJcblx0MFx1YWNmYyAxXHViODVjIFx1Yzc3NFx1YjhlOFx1YzViNFx1YzljNCBOICogTSBcdWQ1ODlcdWI4MmNcdWM3NzQgXHVjOGZjXHVjNWI0XHVjODRjXHVjNzQ0IFx1YjU0YywgMVx1Yjg1YyBcdWM3NzRcdWI4ZThcdWM1YjRcdWM5YzQgXHVhYzAwXHVjN2E1IFx1ZDA3MCBcdWM5YzFcdWMwYWNcdWFjMDFcdWQ2MTVcdWM3NDQgXHVjYzNlXHViMjk0IFx1ZDUwNFx1Yjg1Y1x1YWRmOFx1YjdhOFx1Yzc0NCBcdWM3OTFcdWMxMzFcdWQ1NThcdWMyZGNcdWM2MjQuIFx1YzljMVx1YzBhY1x1YWMwMVx1ZDYxNVx1Yzc0MCBcdWM4MDRcdWNjYjRcdWFjMDAgMVx1Yjg1YyBcdWFjMDBcdWI0ZGQgX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