当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4890:One to Four

题目描述
Given one n * m matrix consist of only positive numbers, It is guaranteed that the product of n and m is a multiple of 4, therefore, we can divide it into four identical parts(that is, every part is a 4-connected subset and we can obtain each part from each other by rotation and translation, every element must be included in exactly one part).


(Grids that from the same part are labeled by the same colour, all four partitions above are valid.)
Note that the partition below is NOT valid because we can only use translation and rotation, no symmetrical reverse:

Once we choose a partition, we can choose some translation and rotation to make these four parts coincide, finally we add up every four values lying on the same grid and choose the minimum sum as the score of the partition and transformation.
Now you're given the matrix, your task is to choose a proper partition and transformation to get the maximum score.
输入解释
There are several testcases, please process till EOF.
In each test case, first line contains two integers n and m. Following n lines each contains m integers Aij, describing the matrix.
1 ≤ n,m ≤ 30,1 ≤ Aij ≤ 10000.
输出解释
For each testcase output one line contains one integer: the maximum score you can get.
输入样例
2 4
1 1 1 1
2 2 2 2
4 4
1 1 1 3
2 1 3 3
2 2 4 3
2 4 4 4
输出样例
6
10
来自杭电HDUOJ的附加信息
Author Fudan University
Recommend

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4890

最后修改于 2020-10-25T23:17:49+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
12000/6000MS(Java/Others) 65536/65536K(Java/Others)