#P7749. [2019年杭电多校]Rikka with Defensive Line
[2019年杭电多校]Rikka with Defensive Line
Rikka with Defensive Line
Problem Description
As an undergraduate student at Peking University, Rikka is always busy with her study. Therefore, to relax in the summer vacation, Rikka spends a lot of time playing computer games. Today, Rikka is playing a game about a war between two tribes. As the player, Rikka controls the warriors of one tribe to attack the other tribe. The hostile tribe has strongholds, and the coordinate of the th stronghold is . A defensive line is built among the strongholds: it is a straight line on the coordinate system which divides the whole plane into two regions. The first goal of the game is to capture this defensive line. As a sophisticated player, Rikka finds that if some of the strongholds are destroyed and all of the remaining strongholds are strictly lying on the same side of the defense line (lying exactly on the defensive line is not allowed), she can capture the defense line with a very small price. Therefore, Rikka will firstly achieve this condition by destroying the minimum number of strongholds at the beginning of the game. After repeating the game times, Rikka finds that she can always achieve the goal by destroying at most strongholds. She is curious about this phenomenon. Therefore, Rikka asks Yuta, a master of information technology, to read the source code of the game and find out the reason. Yuta finds that while initializing, the game will always choose two strongholds and make the defensive line be the only straight line passing through them. Then, to decrease the difficulty, the game will check whether the "easy condition" (i.e., the condition found by Rikka) can be achieved by destroying at most strongholds: If not, the game will repeat the initialize process until the chosen defensive line is valid. After observing this secret, Rikka gives the map of the games to you, i.e., the coordinates of the strongholds. For each stronghold , Rikka wants you to calculate the number of other strongholds so that line is a valid defensive line.
Input
The first line of the input contains a single integer , the number of test cases. For each test case, the first line contains two positive integers , the number of strongholds and the secret constant in the source code. Then lines follow, each line with two integers , which represents the coordinates of the strongholds. The input guarantees that there are no more than test cases with and no two strongholds share the same coordinate or coordinate, i.e., for any two different strongholds , and .
Output
For each test case, output the single line with integers which represent the answer for each stronghold. Hint In the first two test cases, only the are valid defensive lines where represents the straight line passing through the th and th strongholds. In the third test case, any pair of strongholds can from a valid defensive line.
Sample Input
3
5 2
1 0
4 1
3 4
0 3
2 2
5 3
1 0
4 1
3 4
0 3
2 2
5 4
1 0
4 1
3 4
0 3
2 2
Sample Output
2 2 2 2 0
2 2 2 2 0
4 4 4 4 4
Source
2019 Multi-University Training Contest 9