Hide

Problem J
Jabbing Jets

/problems/jabbingjets/file/statement/en/img-0001.jpg
CC BY 3.0 by gratuit on freeimageslive.co.uk

You have just gotten a new job at the Bathroom Accessories Production Company. The first task you are given is to jab holes into showerheads. To prove yourself, you have decided you want to create as many holes as possible.

However, you cannot just randomly drill holes everywhere in the showerhead.1 In order to ensure that the showerheads look aesthetically pleasing, the company has composed some guidelines which you will have to follow. See Figure 1 for some examples of aesthetically pleasing showerheads.

  • The holes should be arranged in concentric circles of radii $r_1, r_2, \ldots , r_n$: the center of every hole should be on one of these circles.

  • The distance between the centers of any two holes should be at least $e$.

How many holes can you make at most?

\includegraphics[width=0.7\textwidth ]{figure.pdf}
Figure 1: Possible aesthetically pleasing showerheads for the first two samples.

Input

The input consists of:

  • One line with two integers $n$ and $e$ ($1 \leq n, e \leq 10^4$), the number of circles and the minimal distance between holes.

  • One line with $n$ integers $r_1, \ldots , r_n$ ($1 \leq r_i \leq 10^4$), the radii of the circles.

It is guaranteed that the numbers $r_i$ are given in increasing order, and that $r_{i+1} - r_i \geq e$. Furthermore, it is guaranteed that increasing any radius $r_i$ by at most $10^{-6}$ will not change the final answer.

Output

Output the maximal number of holes that you can make in the showerhead.

Sample Input 1 Sample Output 1
4 1
2 3 5 7
104
Sample Input 2 Sample Output 2
2 2
2 5
21
Sample Input 3 Sample Output 3
3 20
14 53 80
44

Footnotes

  1. At least, not without getting fired.

Please log in to submit a solution to this problem

Log in