CF321D.Ciel and Flipboard
省选/NOI-
通过率:0%
时间限制:4.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Fox Ciel has a board with n rows and n columns, there is one integer in each cell.
It's known that n is an odd number, so let's introduce
. Fox Ciel can do the following operation many times: she choose a sub-board with size x rows and x columns, then all numbers in it will be multiplied by -1.
Return the maximal sum of numbers in the board that she can get by these operations.
Fox Ciel 有一个 n 行 n 列的方格板,每个格子中有一个整数。
已知 n 是奇数,因此我们定义 x=2n+1。Fox Ciel 可以执行以下操作任意多次:她选择一个大小为 x 行 x 列的子方格板,并将其中所有数字乘以 −1。
返回通过这些操作所能得到的方格板上数字之和的最大值。
输入格式
The first line contains an integer n, (1 ≤ n ≤ 33, and n is an odd integer) — the size of the board.
Each of the next n lines contains n integers — the numbers in the board. Each number doesn't exceed 1000 by its absolute value.
第一行包含一个整数 n(1≤n≤33,且 n 为奇数)—— 表示棋盘的大小。
接下来的 n 行,每行包含 n 个整数 —— 表示棋盘中的数字。每个数字的绝对值不超过 1000。
输出格式
Output a single integer: the maximal sum of numbers in the board that can be accomplished.
输出一个整数:棋盘上所能达到的最大数字之和。
输入输出样例
输入#1
3 -1 -1 1 -1 1 -1 1 -1 -1
输出#1
9
输入#2
5 -2 0 0 0 -2 0 -2 0 -2 0 0 0 -2 0 0 0 -2 0 -2 0 -2 0 0 0 -2
输出#2
18
说明/提示
In the first test, we can apply this operation twice: first on the top left 2 × 2 sub-board, then on the bottom right 2 × 2 sub-board. Then all numbers will become positive.

在第一个测试用例中,我们可以执行该操作两次:第一次作用于左上角的 2×2 子棋盘,第二次作用于右下角的 2×2 子棋盘。之后,所有数字都将变为正数。

输入解题思路,AI测评打分。不知道怎么写?