TLE '17 Contest 2 P3 - Willson and Migration

View as PDF

Submit solution


Points: 10 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Willson and his family migrating.

Willson the Canada Goose is like any other Canada goose - he migrates south for winter. As anyone knows, geese like to travel with their families.

Today, Willson is migrating with his family. There happen to be N families of migrating geese, numbered from 1 to N. Willson's family is family 1. The ith family's journey can be represented by a ray starting at point (xi1,yi1) and heading toward the point (xi2,yi2). Note that families do not stop upon reaching their heading point. It is guaranteed that the starting and heading points are distinct. Each family begins flight at the same time and flies at a speed of vi units per second, indefinitely.

However, when families collide, some geese might accidentally follow the wrong family. Willson wants to ensure that his family will remain together. Please tell him which other families of geese might come within R units of his family during the flight.

Constraints

1N104

1R104

104xi1,yi1,xi2,yi2104 for all i.

1vi104 for all i.

For 30% of the points, yi1=yi2 for all i.

For an additional 30% of the points, either yi1=yi2 or xi1=xi2 for all i.

Input Specification

The first line of input will contain two integers: N, the number of families of geese, and R.

N lines of input follow. The ith line will contain five integers: xi1,yi1,xi2,yi2,vi.

Output Specification

Output, on separate lines and in order, the families that come within R units of Willson's family. If there are no such families, do not output anything.

Sample Input

Copy
5 5
0 0 1 1 10
-4 -5 0 -1 9
10 4 9 4 2
100 200 101 100 7
2 6 0 6 24

Sample Output

Copy
3
4

Comments

There are no comments at the moment.