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

31147번 - New Queries On Segment Deluxe 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB268830.769%

문제

You know those problems where you are given an array of length roughly 10ドル^5$ and you have to process roughly 10ドル^5$ queries about something on a segment? Yes, this is one of those problems. And it should be persistent, because why not.

Consider $k \times n$ matrix $A$ (with $k$ rows and $n$ columns). For a given matrix we can construct the array $B$ as follows: $B_{j} = \sum_{i=1}^{k} A_{ij}$.

There will be up to $q+1$ versions of the matrix. The $j$-th element in $i$-th row of $t$-th version of $A$ is denoted as $A_{ij}^{(t)}$. The $j$-th element of the array $B$ corresponding to $t$-th version of $A$ is denoted as $B_{j}^{(t)}$.

You are given the 0ドル$-th version of the matrix $A$. You have to process $q$ queries of 3 types:

  • 1 t p l r x : add $x$ to $A_{pi}^{(t)}$ for $l \le i \le r,ドル thus creating a new version of the matrix
  • 2 t p l r y : set $A_{pi}^{(t)}$ to be equal to $y$ for $l \le i \le r,ドル thus creating a new version of the matrix
  • 3 t l r : print $\min_{i=l}^{r} B_{i}^{(t)}$

The version of the matrix $A$ created after the $i$-th query will be called the $i$-th version. Thus version numbers can be from 0ドル$ to $q$ inclusive, but some of the integers from 0ドル$ to $q$ may not have the correspondent version.

입력

The first line of input contains 3 integers $k,ドル $n,ドル $q$ (1ドル \le k \le 4,ドル 1ドル \le n \le 250,000円,ドル 1ドル \le q \le 20,000円$) --- the dimensions of the matrix and the number of queries respectively.

The $i$-th of the next $k$ lines contains $n$ integers $A_{i1}^{(0)}, A_{i2}^{(0)}, \ldots, A_{in}^{(0)}$ ($|A_{ij}^{(0)}| \le 10^{8}$).

The next $q$ lines describe the queries in the format explained earlier. It is guaranteed that $t$ refers to a valid already existing version of the matrix, 1ドル \le p \le k,ドル 1ドル \le l \le r \le n,ドル $|x| \le 10^{4},ドル $|y| \le 10^{8}$.

It is guaranteed that there exists at least one query of type 3ドル$.

출력

Print the answers to the queries of type 3ドル$ in the order in which the queries were given, on separate lines.

제한

예제 입력 1

2 5 8
1 2 3 4 5
10 8 6 4 2
3 0 2 5
2 0 2 1 5 0
3 2 2 5
1 0 1 3 5 5
3 4 2 5
1 2 2 1 3 2
3 0 2 5
3 6 2 5

예제 출력 1

7
2
10
7
4

노트

Here is how the versions of the matrix will look like:

The number in a circle is the version, the numbers in rhombuses are queries of type 3ドル$.

출처

Contest > Open Cup > 2021/2022 Season > Stage 7: Grand Prix of Southeastern Europe B번

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2021 B번

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

출처

대학교 대회

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

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