Logo
(追記) (追記ここまで)

2901번 - CHUCK 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB65151423.729%

문제

You are given an matrix of R rows and C columns. All elements of the matrix are by their absolute value smaller than or equal to 104.

You may perform the following operations:

Operation Notation Example
Rotate i-th row of he matrix k elements right rotR i k rotR 3 1
\(\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ 10 & 11 & 12 \end{pmatrix}\rightarrow \begin{pmatrix} 1&2&3 \\ 4&5&6 \\ 9&7&8\10円&11&12 \end{pmatrix} \)
Rotate j-th column of the matrix k elements down rotS j k rotS 3 2
\(\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ 10 & 11 & 12 \end{pmatrix}\rightarrow \begin{pmatrix} 1&2&9 \\ 4&5&12 \\ 7&8&3\10円&11&6 \end{pmatrix} \)
Multiply all elements in the i-th row by -1, if and only if none of them were multiplied before. negR i negR 2
\(\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ 10 & 11 & 12 \end{pmatrix}\rightarrow \begin{pmatrix} 1 & 2 & 3 \\ -4 & -5 & -6 \\ 7 & 8 & 9 \\ 10 & 11 & 12 \end{pmatrix}\)
Multiply all elements in the j-th column by -1, if and only if none of them were multiplied before. negS j negS 1
\(\begin{pmatrix} 1 & 2 & 3 \\ 0&0&0 \\ 7 & 8 & 9 \\ 10 & 11 & 12 \end{pmatrix}\rightarrow \begin{pmatrix} -1 & 2 & 3 \\ 0 & 0 & 0\\ -7 & 8 & 9 \\ -10 & 11 & 12 \end{pmatrix}\)

Using limited number of these operations, you need to maximize the sum of all the elements of the matrix.

입력

The first line of input contains two integers R and C (1 ≤ R, C ≤ 100), number of rows and columns.

The next R lines contain C integers each. All integers are by their absolute value smaller than 104.

출력

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 in the table below. For details look at sample test cases.

  • 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 T>5×R×C, you are awarded 0 points for that test case

제한

예제 입력 1

3 4
1 -2 5 200
-8 0 -4 -10
11 4 0 100

예제 출력 1

345 2
rotS 2 1
negR 2

예제 입력 2

3 3
8 -2 7
1 0 -3
-4 -8 3

예제 출력 2

34 4
rotR 1 1
rotS 3 1
negR 2
negR 3

힌트

출처

Contest > Croatian Open Competition in Informatics > COCI 2009/2010 > Contest #5 6번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /