Superman and the 5th-Dimension
All submissions for this problem are available.
Superman has lost his powers temporarily due to his Solar Flare attack. Mr. Mxyzpltk uses this chance to trap him in the 5th dimension. We know that the 5th dimension has wonky rules. Superman sees a N x M matrix there. Superman can gain power by selecting a submatrix. The power he gains that can be given by the size of the submatrix times the gcd of all the elements of the submatrix. What is the maximum power that he can gain?
The first line contains the number of test cases, T.
- For each test cases, the first line contains 2 integers, the number of rows, N, and the number of columns, M.
- N lines follow, each containing M integers, the elements in the Nth row of the matrix.
For each test case, print the answer to the problem.
- 1<= each entry of A <=10^9
- Sum of N*M over all test cases is lesser than 4*10^4
Input: 1 1 1 1 Output: 1
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions