#P8261. [CTS2022] 袜子
[CTS2022] 袜子
Problem Description
Given points , . There are queries. Each query gives , and asks for the number of ordered pairs such that , , and .
Input Format
The first line contains two integers .
The next lines each contain three integers , .
The next lines each contain three integers .
Output Format
Output lines, each containing one integer, representing the answer.
5 2
2 -1 1
0 -3 5
1 -3 2
1 3 5
3 2 2
1 2 4
1 -2 -9
2
9
Hint
Sample explanation:
The first query corresponds to .
The second query corresponds to $(1, 1)(2, 2)(2, 4)(3, 3)(3, 5)(4, 2)(4, 4)(5, 3)(5, 5)$.
Constraints:
For of the testdata, .
For another of the testdata, .
For another of the testdata, .
For another of the testdata, .
For another of the testdata, .
For another of the testdata, .
For the remaining testdata, there are no special constraints.
Each part of the testdata forms a subtask, with no dependencies.
All testdata satisfy:
.
.
.
.
.
All values are integers.
When , or .
For all testdata except Subtask 4, the coordinates of the points are independently and uniformly randomly chosen within some preset intervals, and it is guaranteed that there are no duplicate points. For the -th point, and are independently randomly chosen, but the distribution of has no special restrictions.
Translated by ChatGPT 5