#P7133. 小 P 的星空
小 P 的星空
Description
Treat the starry sky as a 2D Cartesian coordinate system. Little P is at , i.e., the origin. There are stars in the sky, and the coordinates of the -th star are .
Little P initially faces the point . Then Little P will rotate in place times. After the -th rotation, he will face the point .
He may choose to rotate counterclockwise or clockwise. Once he is facing the final direction of this rotation, the rotation stops immediately.
He believes that, during the rotation, the more stars that appear right in front of him, he [data removed].
Little P wants to know, during each rotation, what is the maximum number of stars that can appear right in front of him (including the stars seen directly in front of him at the initial direction and at the ending direction of the rotation).
Input Format
There are lines in total.
The first line contains two positive integers , representing the number of stars and the number of rotations.
The next lines each contain two integers .
The next lines each contain two integers , with the meaning described in the Description.
In each line, the two numbers are separated by a single space. The input uses Linux line endings, and there are no extra spaces at the end of any line.
Output Format
Output lines, each containing one integer. The integer on line is the answer for the -th rotation.
5 2
1 0
1 1
2 2
-1 2
-2 -1
-1 1
-1 2
4
5
见下发文件 ex_star2.in
见下发文件 ex_star2.out
见下发文件 ex_star3.in
见下发文件 ex_star3.out
Hint
The illustration for Sample 1 is as follows:

Orange points are stars, and the green ray is Little P’s direction during the first rotation. In the first rotation, he turns from to . If he rotates clockwise (the blue region, including the boundary), the stars on and are counted, for a total of stars. If he rotates counterclockwise (the green region, including the boundary), the stars on , , , and are counted, for a total of stars.
In the second rotation, he turns from to . Rotating counterclockwise, all stars will appear right in front of Little P during the rotation.

Except for test points and , all other test points guarantee that the absolute value of every coordinate is .
For the first test points, it is guaranteed that on any ray from the origin to any star, there is no other star.
Except for test points and , for all test points with odd indices, it is guaranteed that there are no stars on Little P’s initial facing direction and on each target direction.
Except for test points and , for all test points with even indices, it is guaranteed that there is at least one star on Little P’s initial facing direction and on each target direction.
For of the data, it is guaranteed that all star coordinates are pairwise distinct, no coordinate equals , and the initial direction of a rotation is never equal to the ending direction.
Sample satisfies the constraints for even-indexed test points.
Translated by ChatGPT 5
京公网安备 11011102002149号