#P8335. [Ynoi2004] tars2
[Ynoi2004] tars2
Problem Description
You need to maintain integer lattice points on a plane. Each point initially has weight . There are operations in total.
Update operation: given , increase the weight of every integer point satisfying by .
Query operation: given , query the sum of weights of all integer points satisfying . The answer is taken modulo .
Input Format
The first line contains an integer . The next lines each describe one operation.
An update operation is given as 1 x y d w.
A query operation is given as 2 x1 x2 y1 y2.
Output Format
For each query operation, output one line containing an integer, which is the answer after taking modulo.
5
1 3 4 5 1
2 1 4 3 5
1 2 4 2 2
2 4 5 3 5
1 4 4 4 8
46
21
Hint
Idea: nzhtl1477, Solution: ccz181078, Code: ccz181078, Data: ccz181078.
Constraints: For of the testdata, , , , .
Translated by ChatGPT 5