TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Have you ever been to Beijing? I had, but I forgot almost everything about it. So, instead of going to Beijing, let us discuss a problem about Beitou!


Beitou is a beautiful place and famous for its hot springs. Byteasar loves hot spring so much and wants to move into Beitou from his hometown - Byteland immediately.


But before moving in, he wants to find a suitable place to build his new house. The land is described as n by m little square pieces, every little square contains a number that indicates the hot spring type of that piece of land. Byteasar wants to pick the largest rectangle to build his house and make sure that, in this area, all the hot spring type of land pieces are pairwise different. Can you help him?

Input Format

Input contains multiple test cases. The first line of each test case contains two integers n, m (1<=n, m<=100) separated by a single space, indicating the size of the map.

Then there are n lines with m integers in each line, the j-th integer Hij in i-th line is the type number of hot spring in position (i,j). (-2,000,000,000 <= Hij <= 2,000,000,000)

Output Format

For each test case, output the area of the largest rectangle land which contains no repetition of hot spring types.

Sample Input 1

3 4
1 2 4 7
3 4 6 8
5 1 -1 3
3 3
1 2 3
3 1 2
2 3 1

Sample Output 1

6
3

Hints

Problem Source

Migrated from old NTUJ.

DarkTmt

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 6000 256000 200