시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 76 | 66 | 63 | 90.000% |
Matrix is a mathematical object which arranges data into a rectangular array of N rows and M columns. The rows are indexed from 1 to N, while the columns are indexed from 1 to M. Matrix is very powerful and extremely useful in many applications. In this problem, we are going to focus on two simple operations in matrix: row addition and column addition.
You are given a matrix of integers of N rows and M columns, and Q queries of the following format:
row
k val: add each element on the k-th row by val,col
k val: add each element on the k-th column by val.Your task is to output the following three numbers after all queries have been performed:
See the sample input for clarity
The first line contains two integers: N M (1 ≤ N, M ≤ 50) denoting the size of the matrix (number of rows and columns, respectively). The next N lines, each contains M integers: Ai,j (-100 ≤ Ai,j ≤ 100) denoting the matrix element at the i-th row and j-th column for 1 ≤ i ≤ N and 1 ≤ j ≤ M, respectively. The next line contains an integer: Q (0 ≤ Q ≤ 100) denoting the number of queries. The next Q lines, each contains a query in one of the following format:
row
k val (1 ≤ k ≤ N; -100 ≤ val ≤ 100)col
k val (1 ≤ k ≤ M; -100 ≤ val ≤ 100)The output contains three integers (each separated by a single space) in a single line: sum min max, as described in the problem statement.
3 4 1 1 1 1 1 1 1 1 1 1 1 1 2 row 1 3 col 4 -2
18 -1 4
These are the matrices after each queries for the first sample.
4 3 10 10 10 10 10 10 10 10 10 10 10 10 5 row 2 -5 col 3 6 col 1 -10 row 4 7 col 1 3
122 -2 23
2 3 15 7 8 31 1 14 3 row 2 -15 col 1 10 row 1 2
57 -14 27
These are the matrices after each queries for the third sample.
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2017 A번