1358. Parcel

单点时限: 10.0 sec

内存限制: 256 MB

We are given a square-shaped field. The field has a side of length n and it is divided into n2 squares of side 1. Each square is either arable or waste land. We delimit a parcel in the field. The parcel ought to be a rectangle and to consist of only arable squares. The area of the parcel is equal to the area of the corresponding rectangle. We seek for a parcel of the largest area.

Task

Write a program which:

1.reads the description of the field,

2.computes the area of the largest parcel (there may be more than one such a parcel),

3.writes the computed area.

输入格式

In the first line there is one integer n, 1 <= n <= 2000. In the successive n lines there are descriptions of squares that compose successive rows of the field. Each of those lines comprises n numbers 0 or 1, separated by single spaces. The numbers describe successive squares in the row: 0 denotes an arable square and 1 denotes a waste square.

输出格式

Your program should write one integer in the first and only line. The number should be the area of the largest parcel. If all the squares are waste and there is no parcel, your program should give the answer 0.

样例

Input
5
0 1 0 1 0
0 0 0 0 0
0 0 0 0 1
1 0 0 0 0
0 1 0 0 0
Output
9

2 人解决,6 人已尝试。

7 份提交通过,共有 23 份提交。

9.3 EMB 奖励。

创建: 17 年,3 月前.

修改: 7 年,2 月前.

最后提交: 1 年,4 月前.

来源: POI

题目标签