weeb Japanese animation enthusiast, so it's no surprise that he enjoys playing osu!, an anime-themed rhythm game. In this game, circles appear one-by-one on the screen, and players are required to move their cursor to them and click on them at just the right time to get points.
New circles usually appear close to the positions of previous circles, but they may occasionally appear on the other side of the screen as well (called "jumps"). , but if the distance is too great, he misses, and his combo (number of successful hits before the miss) resets to 0.
can play well when the distance between two sequential circles is less than or equal toGiven a sequence of coordinates of circles (points) in the form , wants to know what his greatest possible combo is, if he always hits the first point. For the purpose of this problem, assume that circles can only be hit at exactly the specified point.
Input Specification
The first line will contain 2 space-separated integers and , representing the total number of circles in the sequence and 's greatest jump distance respectively.
The next lines will each contain 2 space-separated integers, and , representing the coordinates of the circle.
Output Specification
Output a single integer representing the longest possible combo
can achieve.Sample Input
5 5
0 0
1 1
2 1
2 -6
-1 -4
Sample Output
3
Comments
After he misses, is his next click guaranteed or does it still have to be within his reach?
Sorry for the late reply, but yes, his next click is guaranteed.
Consider this test case.
Kashif can forgo the second circle to get a combo of 3, instead of getting a combo of 2 if he hits in order.
In osu! the circles must be clicked in the order they show up (I.E. no skipping).
Can Kashif continue game after he misses for the first time? And should all circles be hit in consecutive way?
Yes, misses only affect combo, and yes, all circles must be hit in the order given in input.