#B3679. Blocking the Spawn Machine

    ID: 11338 Type: Default 1000ms 256MiB

Blocking the Spawn Machine

Blocking the Spawn Machine

In a generalized version of the game, there are n puzzle machines on the map. The i-th machine is located at ( (x_i, y_i) ). There are also k survivors. Each survivor chooses one machine as their spawn point, and the chosen machines are called birth password machines.

The Regulator, on the other hand, has T candidate spawn positions. The i-th candidate is located at ( (x_i, y_i) ). Due to the special "ban" talent, for a given regulator spawn point, the puzzle machine that is farthest from the regulator will be blocked (i.e. it will not be decipherable).

( \textbf{Note:} ) If there are multiple machines with the same maximum distance from the regulator, the one with the smallest index among them will be blocked.

Assume that the survivors have pre-selected their birth machines as the machines with indices (1, 2, \dots, k) (i.e. only the first k machines are chosen as spawn points for survivors).

Your task is to determine, among the T regulator spawn points, how many will result in the blocked machine (the one farthest from the regulator) being one of the survivors' chosen machines (i.e. having an index ( \le k )).

The distance between points ( (x_1,y_1) ) and ( (x_2,y_2) ) is defined as ( \sqrt{(x_1-x_2)^2+(y_1-y_2)^2} ). Note that you may compare distances using their squared values to avoid floating point precision issues.

inputFormat

The input consists of several parts:

  • The first line contains three integers: ( n ) (the number of puzzle machines), ( k ) (the number of survivors, and thus the first ( k ) machines are chosen), and ( T ) (the number of candidate regulator spawn points).
  • The next ( n ) lines each contain two integers ( x_i ) and ( y_i ) representing the coordinates of the ( i )-th puzzle machine.
  • The following ( T ) lines each contain two integers ( x ) and ( y ) representing the coordinates of a candidate regulator spawn point.

outputFormat

Output a single integer representing the number of regulator spawn points for which the blocked (i.e. farthest) puzzle machine is one of the survivors' chosen machines (with index ( \le k )).

sample

3 2 3
0 0
1 0
0 1
0 1
1 1
-1 -1
3