#P7711. [Ynoi2077] 3dmq
[Ynoi2077] 3dmq
Description
You are given points in a 3D space. Each point has coordinates , and weights , where is initially .
There are operations:
x y z w: Compute the sum of over all points such that . After finishing the sum, for all points such that , increase their weight by .
Input Format
The first line contains two integers .
Then lines follow, each containing four integers , with meanings as described above.
Then lines follow, each containing four integers , with meanings as described above.
Output Format
For each operation, output one line with one number representing the answer.
Since the answer may be very large, you only need to output the result modulo .
10 10
5 8 4 10
6 9 6 1
1 2 7 4
7 7 3 4
9 1 5 5
3 4 8 10
8 6 1 3
2 10 2 3
4 5 9 2
10 3 10 4
9 4 2 9
10 10 4 0
3 6 1 0
2 9 4 0
4 9 4 0
7 6 8 3
4 4 7 0
3 4 9 0
7 2 9 8
7 10 2 0
0
0
0
0
0
0
12
42
12
0
Hint
Idea: ccz181078, Solution: ccz181078, Code: ccz181078, Data: nzhtl1477
For of the testdata, . The initial set of points and weights are generated uniformly at random. are permutations of to . . Operations are generated uniformly at random, and in each operation, with probability , its is .
This problem is scored based on the number of queries your program answers correctly. If your program answers the first queries correctly, then if , you will get a score of . Otherwise, you will get . The spj will stop reading when it reads the first wrong answer, or reaches the end of your output, or reads the first lines. Any further output will be ignored. Do not add spaces at the end of lines.
Note: If your program TLEs, you will get 0 points.
Translated by ChatGPT 5
京公网安备 11011102002149号