Chuck
의견: 0
You are given a matrix of \(R\) rows and \(C\) columns. All elements of the matrix are by their absolute value smaller than or equal to \(10^4\).
You may perform the following operations:
rotR i k— Rotate the \(i\)-th row of the matrix \(k\) elements right.rotS j k— Rotate the \(j\)-th column of the matrix \(k\) elements down.negR i— Multiply all elements in the \(i\)-th row by \(-1\), if and only if none of them were multiplied before.negS j— Multiply all elements in the \(j\)-th column by \(-1\), if and only if none of them were multiplied before.
Using a limited number of these operations, you need to maximize the sum of all the elements of the matrix.
• If the obtained sum is not maximal, one of the elements was multiplied
more than once or the sequence of operations printed does not lead to
the sum, 0 points are awarded.
• Otherwise, the number of points depends on the number of operations
used
◦For T
5
\(R\)
\(C\), you are awarded 100% of points allocated to that
test case
◦For 5
\(R\)
\(C < T\)
100 000, you are awarded 50% of points
allocated to that test case
◦For \(T > 100\,000\), you are awarded 0 points for that test case
SAMPLE TEST CASES
Input:
3 4
\(1 -2 5\,200\)
-\(8\ 0 -4 -10\)
11 4 0 100
Input:
3 3
\(8 -2\ 7\)
\(1\ 0 -3\)
-\(4 -8\ 3\)
Output:
Output:
345 2
rotS 2 1
negR 2
34 4
rotR 1 1
rotS 3 1
negR 2
negR 3
The first line of input contains two integers \(R\) and \(C\) (\(1 \le R, C \le 100\)), the number of rows and columns.
The next \(R\) lines contain \(C\) integers each. All integers are by their absolute value smaller than \(10^4\).
The first line of output should contain two integers, the maximal sum obtainable and the number of operations used. We shall call this number \(T\).
The next \(T\) lines should contain any sequence of operations leading to the sum. Each operation should follow the notation defined above.
Scoring:
- If the obtained sum is not maximal, one of the elements was multiplied more than once, or the sequence of operations printed does not lead to the sum, \(0\) points are awarded.
- Otherwise, for \(T \le 5 \cdot R \cdot C\) you are awarded \(100\%\) of the points allocated to that test case; for \(5 \cdot R \cdot C < T \le 100\,000\) you are awarded \(50\%\); for \(T > 100\,000\) you are awarded \(0\) points.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Test 1 | 10점 | None |
Test 2 | 10점 | None |
Test 3 | 10점 | None |
Test 4 | 10점 | None |
Test 5 | 10점 | None |
Test 6 | 10점 | None |
Test 7 | 10점 | None |
Test 8 | 10점 | None |
Test 9 | 10점 | None |
Test 10 | 10점 | None |
3 4
1 -2 5 200
-8 0 -4 -10
11 4 0 100345 2
rotS 2 1
negR 23 3
8 -2 7
1 0 -3
-4 -8 334 4
rotR 1 1
rotS 3 1
negR 2
negR 3평가 및 의견
Chuck
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Chuck