#P5309. [Ynoi2011] 初始化
[Ynoi2011] 初始化
Description
Mayuri has stars, each with a brightness . Mayuri often wants to know the sum of the brightnesses of all stars in an interval . But stars twinkle, so their brightness can change. At times, the brightness of stars with indices increases by . It is guaranteed that .
Mayuri is not very good at math; please answer her queries. The answer should be taken modulo .
Input Format
The first line contains two integers and , the number of stars and the number of operations.
The next line contains numbers , the initial brightness values.
Then follow lines. Each line starts with an integer denoting the operation type: if it is , it is an update, followed by three integers ; if it is , it is a query, followed by two integers .
Output Format
For each query operation, output one line with the answer.
5 6
1 2 3 4 5
2 2 4
1 1 1 1
2 2 4
2 1 3
1 2 1 2
2 1 3
9
12
9
13
Hint
Idea: yanQval, Solution: yanQval, Code: yanQval, Data: yanQval & nzhtl1477.
Constraints:
- For of the testdata, .
- For another of the testdata, .
- For another of the testdata, .
- For another of the testdata, .
- For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号