#P3691. 妖精大战争
妖精大战争
Description
The Three Fairies of Light Sunny Milk, Lunar Child, and Star Sapphire destroyed the ice fairy Cirno’s house to lure her into their prank plan. Of course, Cirno would not let it go. She found the Three Fairies to take revenge, in the form of a danmaku duel. On Normal difficulty, Star Sapphire does not appear in this duel, so only Sunny Milk and Lunar Child face off against Cirno.
In one spell card, the danmaku fired by Sunny Milk and Lunar Child almost fills the entire square battlefield, and can be exactly divided into two parts by a stationary, non-vertical straight line. The region above the line is Sunny Milk’s sunlight danmaku, and the region below the line is Lunar Child’s moonlight danmaku.
Cirno is the strongest fairy, but even she gets nervous in the face of dense danmaku from two fairies. Just as her motivation is about to run out, she realizes that if she can use two different strategies for the two kinds of danmaku, her chances of winning will greatly increase. Therefore, she wants to know what kind of danmaku will appear at some key positions.
Unfortunately, Cirno cannot determine where the separating line is. She only knows the current positions of every danmaku on the battlefield and whether each one is moonlight or sunlight. In rare cases (at most ), Cirno may misidentify the type of danmaku because they look so similar. What Cirno wants to know is: for positions where danmaku may appear next, if danmaku does appear, will it be moonlight or sunlight? Can you help her?
Input Format
The first line contains three positive integers , denoting the number of danmaku currently on the field, the number of positions Cirno wants to query, and that is the index of the current test point.
The next lines each contain two real numbers and an integer , separated by spaces. This means there is a danmaku of type at . Here represents sunlight danmaku, and represents moonlight danmaku.
The next lines each contain two real numbers , representing positions where Cirno wants to know what type of danmaku would appear if danmaku appears there.
Output Format
Output lines, each containing one integer or , corresponding to the result for each query.
means sunlight danmaku, and means moonlight danmaku.
4 4 0
3.000 4.000 1
3.000 3.000 -1
8.000 3.000 -1
8.000 4.000 1
100.000 100.000
0.000 0.000
3.141 5.926
0.618 1.618
1
-1
1
-1
Hint
[Sample explanation]
Note: This testdata is invalid due to being too small and lacking sufficient information to determine an accurate answer. It is only for understanding the problem statement and should not be used to test your program.
From the input, we observe that when , they are all moonlight danmaku, and when , they are all sunlight danmaku. We may guess that the separating line lies between .
Therefore, for the four queries, answer respectively.
[Constraints and notes]
-
The area of a single danmaku can be considered .
-
If a query position lies exactly on the separating line, treat it as being below the line.
-
This problem uses a Special Judge.
-
For test point :
, .
If the number of correctly answered queries in your output is at least of all queries, you will receive full score for this test point; otherwise, points.
- For test points :
, .
If the number of correctly answered queries in your output is at least of all queries, you will receive full score for this test point; otherwise, points.
- For test points :
, .
If the number of correctly answered queries in your output is at least of all queries, you will receive full score for this test point; otherwise, points.
- For test points :
, .
If the number of correctly answered queries in your output is at least of all queries, you will receive full score for this test point; otherwise, points.
- For of the testdata:
.
All input real numbers have exactly decimal places.
It is guaranteed that the input has a valid solution that can meet the required accuracy thresholds.
Time limit: for test points , the limit is ; for the other test points, the limit is .
Translated by ChatGPT 5
京公网安备 11011102002149号