Under construction

Still being built. Things may change

Prisoners

Interview

Time limit1sMemory limit1024 MB

Summary
Find the fewest guards to remove so that a path from the west wall to the east wall keeps more than 100 meters from every guard.
Level

Medium6 of 10

Topics
Graph, Geometry, BFS
Solved
No attempts yet

Problem

Prisoners of a camp plan an escape. The only way out passes through a canyon that is PP meters long and LL meters wide. The canyon has NN guards, each standing at a fixed post. Every guard can see up to 100 meters exactly. To avoid being spotted, the prisoners must sneak through the canyon so that the distance to the nearest guard is always strictly greater than 100 meters, as the figure below shows.

The prisoners, tired of violence, want to clear the way out by removing as few guards as possible. Write a program that finds this minimum number.

You may assume the prisoners can remove any guards, including those that other guards can see.

Input

The first line contains three integers PP (1≤P≤500001 \le P \le 50000), LL (1≤L≤500001 \le L \le 50000), and NN (1≤N≤2501 \le N \le 250). Each of the next NN lines contains the integer coordinates XiX_i and YiY_i of one guard (0≤Xi≤P0 \le X_i \le P, 0≤Yi≤L0 \le Y_i \le L). The southwest corner of the canyon is (0,0)(0, 0), and the northeast corner is (P,L)(P, L).

The prisoners may enter the canyon at any point (0,Ys)(0, Y_s) with 0≤Ys≤L0 \le Y_s \le L, and exit at any point (P,Yv)(P, Y_v) with 0≤Yv≤L0 \le Y_v \le L. YsY_s and YvY_v do not have to be integers.

Output

Print one non-negative integer on a single line of the text file, the minimum number of guards that must be removed.

Examples1

  1. Example 1

    Input
    530 340 5
    210 50
    330 130
    270 170
    200 180
    260 260
    
    Expected output
    1