bzoj#P3311. [USACO2013 Nov] Line of Sight

[USACO2013 Nov] Line of Sight

Description

Farmer John's NN cows are located at distinct points in his two-dimensional pasture. In the middle of the pasture is a large circular grain silo. Cows on opposite sides of the silo cannot see each-other, since the silo blocks their view. Please determine the number of pairs of cows that can see each-other via a direct line of sight.

The grain silo is centered at the origin (0,0)(0,0) and has radius RR. No cow is located on or inside the circle corresponding to the silo, and no two cows lie on a tangent line to the silo.

Input

Line 11: Two integers: N,RN,R.

Lines 21+N2\sim 1+N: Each line contains two integers specifying the (x,y)(x,y) coordinates of a cow.

Output

Line 11: The number of pairs of cows who can see each-other.

4 5
0 10
0 -10
10 0
-10 0
4

Sample Explain 1

There are 44 cows at positions (0,10),(0,10),(10,0),(10,0)(0,10),(0,-10),(10,0),(-10,0). The silo is centered at (0,0)(0,0) and has radius 55.

All 66 pairs of cows can see each-other, except for the pairs situated on opposite sides of the silo: the cows at (10,0)(-10,0) and (10,0)(10,0) cannot see each-other, and the cows at (0,10)(0,-10) and (0,10)(0,10) cannot see each-other.

Data scale and Agreement

For 100%100\% data, 1N5×1041\leq N\leq 5\times 10^4, 1R1061\leq R\leq 10^6, 106x,y106-10^6\leq x,y\leq 10^6.

Source

Gold