CHUCK
Time limit1sMemory limit128 MB
Given a matrix with row/column rotation and one-time row/column sign flip operations, compute the maximum achievable total sum.
Problem
You are given a matrix with R rows and C columns. Every element has absolute value at most 10^4. You may apply the following operations any number of times.
Using these operations, make the sum of all elements of the matrix as large as possible.
Input
The first line contains two integers R and C (1 <= R, C <= 100), the number of rows and columns.
Each of the next R lines contains C integers. Every integer has absolute value less than 10^4.
Output
Print a single integer: the maximum possible sum of all elements of the matrix after applying the operations.