P14546 [HackerRank] Largest coprime submatrix
提高-
题目描述

Given a matrix you need to find the submatrix with the largest number of elements, where the GCD (Greatest Common Divisor) of its elements is greater than one. A submatrix of the matrix is a sub-section composed of contiguous rows and columns of the original matrix.

Input
Two numbers n,m in the first line. Followed by n lines with m numbers in each line.

Constraints

1<=N,M<=200

1<=numbers<=10000

Output
Just a largest area where GCD is greater than 1.

Sample Input

3 3
2 6 8
4 8 3
6 9 4

Sample Output

4

If you observe the following submatrix:

2 6
4 8

The GCD is 2.
There is no matrix larger than this with a GCD > 1.

输入格式

见题面

输出格式

见题面

样例输入
3 3 2 6 8 4 8 3 6 9 4
样例输出
4