#P1438. 无聊的数列
无聊的数列
Description
Maintain a sequence supporting two operations:
-
1 l r K D: You are given an arithmetic progression of length with first term and common difference , and you add it correspondingly to each number in the range . Specifically: let $a_l=a_l+K,a_{l+1}=a_{l+1}+K+D\ldots a_r=a_r+K+(r-l) \times D$. -
2 p: Query the value of the -th element .
Input Format
The first line contains two integers denoting the length of the sequence and the number of operations.
The second line contains integers, where the -th number is .
Each of the next lines starts with an integer .
If , then four more integers follow.
If , then one more integer follows.
Output Format
For each query, output one integer per line representing the answer.
5 2
1 2 3 4 5
1 2 4 1 2
2 3
6
Hint
Constraints
For of the testdata, $0\le n,m \le 10^5,-200\le a_i,K,D\le 200, 1 \leq l \leq r \leq n, 1 \leq p \leq n$.
Translated by ChatGPT 5
京公网安备 11011102002149号