时间限制:C/C++/Rust/Pascal 4秒,其他语言8秒 空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M 64bit IO Format: %lld
题目描述
Given an Matrix where each integer appears exactly once in . Let the value of a submatrix of as the greatest common divisor (GCD) of all the entries among the submatrix, you need to determine the sum of the values for all continuous submatrices of .
输入描述:
The first line contains two integers and . Following lines each contains integers , denoting the given matrix. It is guaranteed that each integer appears exactly once in .
输出描述:
Output one line containing one integer, denoting the answer.