## RGPC '17 P1 - Circle Clicking!

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Kashif is a pretty big 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 the positions of previous circles, but they may occasionally appear on the other side of the screen as well (called "jumps"). Kashif can play well when the distance between two sequential circles is less than or equal to , but if the distance is too great, he misses, and his combo (number of successful hits before the miss) resets to 0.

Given a sequence of coordinates of circles (points) in the form , Kashif 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 Kashif'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 Kashif can achieve.

#### Sample Input

5 5
0 0
1 1
2 1
2 -6
-1 -4

#### Sample Output

3

• commented on Feb. 19, 2017, 3:46 p.m.

After he misses, is his next click guaranteed or does it still have to be within his reach?

• commented on Feb. 19, 2017, 6:22 p.m.

Sorry for the late reply, but yes, his next click is guaranteed.

• commented on Feb. 19, 2017, 12:01 p.m.

Consider this test case.

5 5
0 0
1 1
2 -7
2 -6
-1 -4

Kashif can forgo the second circle to get a combo of 3, instead of getting a combo of 2 if he hits in order.

• commented on Feb. 19, 2017, 12:37 p.m.

In osu! the circles must be clicked in the order they show up (I.E. no skipping).

• commented on Feb. 18, 2017, 12:06 p.m. edited

Can Kashif continue game after he misses for the first time? And should all circles be hit in consecutive way?

• commented on Feb. 18, 2017, 1:11 p.m.

Yes, misses only affect combo, and yes, all circles must be hit in the order given in input.