Gopher II
InterviewTime limit1sMemory limit128 MB
Each gopher escapes if some hole within s*v metres is assigned to it, one gopher per hole; minimize the number of gophers left out by finding a maximum matching.
- Level
Medium6 of 10
- Topics
- Graph, Union-find, Brute force, Geometry
- Solved
- No attempts yet
Problem
The gopher family, having averted the canine threat, must now face a new predator.
There are gophers and gopher holes, each located at a distinct coordinate. A hawk arrives, and any gopher that fails to reach a hole within seconds is vulnerable to being eaten. Each hole can shelter at most one gopher. Every gopher runs at the same speed . The gopher family needs an escape plan that minimizes the number of vulnerable gophers.
Since a gopher can travel at most metres, a gopher can escape into a hole whenever the distance between them is at most .
Input
The input consists of several test cases. The first line of each case contains four positive integers less than : , , , and . The next lines give the coordinates of the gophers, and the following lines give the coordinates of the gopher holes. All distances are in metres, all times are in seconds, and all speeds are in metres per second. Input continues until end of file.
Output
For each case, output a single line containing the number of vulnerable gophers.