| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 24 | 20 | 17 | 89.474% |
You are given an $N \times N$ matrix $A$ initialized with arbitrary values. You will receive $Q$ operations, each defined by five values: $R_1, C_1, R_2, C_2, V$. For each operation, you need to update the matrix by adding $V$ to all elements in the submatrix defined by the rows from $R_1$ to $R_2$ and the columns from $C_1$ to $C_2$.
The first line contains two integers $N$ and $Q,ドル the matrix size and the number of operations. $(1 \leq N \leq 1,000,円 1 \leq Q \leq 200,000円)$
The next $N$ lines each contain $N$ integers, forming the initial matrix $A$. $(0 \leq A_{ij} \leq 100)$
Each of the next $Q$ lines contains five integers $R_1, C_1, R_2, C_2, V,ドル describing an operation to add $V$ to every element in the submatrix with rows $R_1$ to $R_2$ and columns $C_1$ to $C_2$ (1-based indices, and 1ドル \leq R_1 \leq R_2 \leq N, 1 \leq C_1 \leq C_2 \leq N, 0 \leq V \leq 100)$.
Print the resulting matrix after performing all $Q$ operations: $N$ lines, each with $N$ integersseparated by spaces.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 60 | 1ドル \leq N \leq 1,000,円 1 \leq Q \leq 10$ |
| 2 | 20 | 1ドル \leq N \leq 1,000,円 1 \leq Q \leq 10,000円$ |
| 3 | 20 | 1ドル \leq N \leq 1,000,円 1 \leq Q \leq 200,000円$ |
4 2 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 2 1 2 2 4 4 2
1 1 0 5 1 3 2 2 1 3 2 2 0 2 2 2
This example satisfies the conditions of Subtask 1, 2 and 3.
University > 서강대학교 > CSE4152 문제해결프로그래밍실습 > 2025-2학기 중간고사 코딩 테스트 2번