#P2831. [NOIP 2016 提高组] 愤怒的小鸟
[NOIP 2016 提高组] 愤怒的小鸟
Description
Kiana has recently become addicted to a magical game.
Simply put, this game takes place on a plane.
There is a slingshot at . Each time, Kiana can use it to launch a red bird toward the first quadrant. The flight trajectory of a bird is a curve of the form , where are parameters chosen by Kiana and must satisfy , with being real numbers.
When a bird falls back to the ground (i.e., the -axis), it disappears instantly.
In a certain level of the game, there are green pigs in the first quadrant of the plane. The -th pig is at coordinates .
If a bird’s trajectory passes through , then the -th pig will be eliminated, and the bird will continue along its original trajectory. If a bird’s trajectory does not pass through , then that bird’s entire flight has no effect on the -th pig.
For example, if two pigs are at and , Kiana can choose to launch a bird with trajectory , and both pigs will be eliminated by this bird.
The goal of the game is to eliminate all the pigs by launching birds.
Each level of this magical game is difficult for Kiana, so she also entered some mysterious commands to make it easier to complete the game. These commands are detailed in Input Format.
Assume the game has levels. Now Kiana wants to know, for each level, the minimum number of birds needed to eliminate all the pigs. Since she cannot compute it herself, she hopes you will tell her.
Input Format
The first line contains a positive integer , the total number of levels in the game.
Then, for each of the levels, the first line contains two non-negative integers , representing the number of pigs in that level and the type of mysterious command Kiana entered, respectively. The next lines each contain two positive real numbers , indicating that the -th pig is at . It is guaranteed that no two pigs in the same level share identical coordinates.
If , it means Kiana entered a command that has no effect.
If , then this level satisfies: at most birds are sufficient to eliminate all pigs.
If , then this level satisfies: there is an optimal solution in which one bird eliminates at least pigs.
It is guaranteed that , , and . All real numbers in the input are given to two decimal places.
In the above, the symbols and denote the ceiling and floor of , respectively. For example: $\lceil 2.1 \rceil = \lceil 2.9 \rceil = \lceil 3.0 \rceil = \lfloor 3.0 \rfloor = \lfloor 3.1 \rfloor = \lfloor 3.9 \rfloor = 3$.
Output Format
For each level, output one line with a positive integer: the minimum number of birds needed to eliminate all pigs in that level.
2
2 0
1.00 3.00
3.00 3.00
5 2
1.00 5.00
2.00 8.00
3.00 9.00
4.00 8.00
5.00 5.00
1
1
3
2 0
1.41 2.00
1.73 3.00
3 0
1.11 1.41
2.34 1.79
2.98 1.49
5 0
2.72 2.72
2.72 3.14
3.14 2.72
3.14 3.14
5.00 5.00
2
2
3
1
10 0
7.16 6.28
2.02 0.38
8.33 7.78
7.68 2.09
7.46 7.86
5.77 7.44
8.24 6.72
4.42 5.11
5.42 7.79
8.15 4.99
6
Hint
Sample Explanation 1.
There are two levels in this set of testdata.
In the first level, as in the Description, pigs are at and . Launching one bird with trajectory is enough to eliminate them.
In the second level, there are pigs, and by observation they all lie on the parabola , so Kiana needs to launch only one bird to eliminate all pigs.
Constraints
| Test point ID | |||
|---|---|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号