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

34745번 - Matrix Addition 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB24201789.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.

제한

서브태스크

번호배점제한
160

1ドル \leq N \leq 1,000,円 1 \leq Q \leq 10$

220

1ドル \leq N \leq 1,000,円 1 \leq Q \leq 10,000円$

320

1ドル \leq N \leq 1,000,円 1 \leq Q \leq 200,000円$

예제 입력 1

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 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번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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