Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RECT3 - Khối tam chữ nhật

Three-rectangle blocks

Given a MxN rectangle (1 ≤ M, N ≤ 200) containing 0 and 1. A three-rectangle block is a shape consiting of three rectangles, each rectangle contains only 1, overlapping one another so that the middle rectangle must be wider than the top and bottom rectangle in both left and right directions by at least one cell.

For example, the following shapes are three-rectangle blocks:

 1	
111
 1	
 
 11		
 11		
11111
   1		
   1		

The following shapes are not three-rectangle blocks:

 111
	 				
11111
 111	
 111	
(The three rectangles are not connected)

 1111
 1111
11111
 111	
 111	
(The middle rectangle is not wider than the top rectangle by at least one cell to the right)

In this problem, you have to find the three-rectangle block that has maximum area.

Input

  • First line: two integers M, N.
  • In the next M lines, each line contains N numbers 0 and 1 (not separated by spaces) representing the rectangle of numbers.

Output

Print the area of the largest three-rectangle block, or 0 if there is no such a block.

Example

Input
6 8
00000110
00111000
00110100
01111001
01111110
00111010

Output
15

Output details
The three-rectangle block:
00000110
00111000
00110100
01111001
01111110
00111010  
Has an area of 15

Another three-rectangle block that has an area of 14:
00000110
00111000
00110100
01111001
01111110
00111010 

Được gửi lên bởi:VOJ Team
Ngày:2008-08-13
Thời gian chạy:0.200s-0.400s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:Tất cả ngoại trừ: ERL GOSU JS-RHINO NODEJS PERL6 PYPY RUST SED VB.NET
Nguồn bài:VNOI Marathon'08-Round 9/DivA
Problem Setter:Nguyễn Trần Nam Khánh

hide comments
2017-07-04 05:27:30
n ^ 3 TLE -_-
2012-04-08 04:00:56 Noyethug
times cũng ổn mà..:)
m*n*n là qua nhỉ :D

Last edit: 2012-04-08 16:05:59
2011-06-14 09:57:02 Cao Viên Viên
time chặt quá !! nới ra 4s đi p/s :X
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.