CF1584G.Eligible Segments
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given n distinct points p1,p2,…,pn on the plane and a positive integer R .
Find the number of pairs of indices (i,j) such that 1≤i<j≤n , and for every possible k ( 1≤k≤n ) the distance from the point pk to the segment between points pi and pj is at most R .
输入格式
The first line contains two integers n , R ( 1≤n≤3000 , 1≤R≤105 ) — the number of points and the maximum distance between a point and a segment.
Each of the next n lines contains two integers xi , yi ( −105≤xi,yi≤105 ) that define the i -th point pi=(xi,yi) . All points are distinct.
It is guaranteed that the answer does not change if the parameter R is changed by at most 10−2 .
输出格式
Print the number of suitable pairs (i,j) .
输入输出样例
输入#1
4 2 0 1 0 -1 3 0 -3 0
输出#1
1
输入#2
3 3 1 -1 -1 -1 0 1
输出#2
3
说明/提示
In the first example, the only pair of points (−3,0) , (3,0) is suitable. The distance to the segment between these points from the points (0,1) and (0,−1) is equal to 1 , which is less than R=2 .
In the second example, all possible pairs of points are eligible.