P30008 [洛谷] [CERC2019] Deep800080
入门
题目描述

Problem Description

Ian, the owner of the Deep800080, plans to have a barbecue on the lake tonight. There is a narrow, straight pier extending from the shore into the lake. Ian thinks it's a good idea to set up the barbecue at some point on the pier.

He wants to test his new special-made barbecue charcoal. When it burns, it produces a unique dense purple smoke that spreads over the water. The smoke is guaranteed to form a perfect circle around the barbecue area. Eventually, the cloud will reach a certain maximum radius and remain constant for the rest of the night until it dissipates later.

There are multiple boats anchored at different distances from the pier in the lake. Ian wants to inform the crews of these boats about the barbecue. Being a bit lazy, he hopes the barbecue smoke can do the job for him. Ian wants the crews to smell the smoke when the cloud reaches their boat, so they immediately know there is a barbecue nearby.

Ian wants to maximize the number of alerted crew members, so he wants to choose a spot on the pier that maximizes the number of boats reached by the purple smoke.

You can assume that the boats on the lake are firmly fixed and will not move when the smoke layer is on the lake. Also, once the barbecue spot is chosen, its position remains unchanged throughout the event.

Input Format

The first line contains four integers $N, R, A, B\ (0\le N\le 3\times 10^5; 1\le R\le 10^6)$. $N$ is the number of boats on the lake, and $R$ is the maximum radius of the purple barbecue smoke. You can consider the pier to be very narrow and long, so it can be treated as a line passing through two different points at coordinates $(0, 0)$ and $(A, B)$.

The next $N$ lines each contain two integers $X$ and $Y$, describing the coordinates of a boat on the lake. No two boats have the same coordinates.

All coordinates are common Cartesian coordinates in the plane, with their absolute values no more than $10^6$.

Output Format

Output a single integer representing the maximum number of boats that the purple barbecue smoke can reach.

A boat is considered reached if its position is within the circle formed by the smoke, including its boundary. You can assume that increasing the maximum radius of the smoke by $10^{-3}$ will not change the solution.

Sample Input and Output

Sample Input #1

7 5 0 1
-1 -1
1 -1
0 0
2 3
3 4
10 10
2 12

Sample Output #1

5

Sample Input #2

3 1 1 0
0 0
2 0
4 0

Sample Output #2

2

Sample Input #3

4 1 1 0
0 0
1 1
1 -1
2 0

Sample Output #3

4

Notes

Sample Explanation

Image

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7 5 0 1 -1 -1 1 -1 0 0 2 3 3 4 10 10 2 12
样例输出
5