Nearby Bicycles

With fast developments of information and communication technology, many cities today have established bicycle sharing systems. The key component of the system is to provide information on nearby bicycles to potential users.

Consider mmm bicycles and nnn customers, where each bicycle is located at coordinate (cj,dj)(c_j , d_j )(cj,dj) for j=1,2,...,m,j = 1, 2, ... , m,j=1,2,...,m, and each user iii is located at coordinate (ai,bi)(a_i, b_i)(ai,bi) for i=1,2,...,ni = 1, 2, ... , ni=1,2,...,n The distance between two coordinates (x,y)(x, y)(x,y) and (x,y)(x, y)(x,y) is measured by (x−x)2+(y−y)2 \sqrt{(x-x)^2 +(y-y)^2}(xx)2+(yy)2 . For each user i=1,2,...,ni = 1,2,...,ni=1,2,...,n, you are given a threshold sis_isi, your task is to return the total number of bicycles that are within a distance of si from user iii.

Input

The test data may contain many test cases. Each test case contains four lines. The first line of each case contains two integers, mmm and n(0<m,n≤1000)n (0 < m, n \le 1000)n(0<m,n1000). The second line contains the coordinates, (c1,d1),(c2,d2),...,(cm,dm)(c_1, d_1), (c_2, d_2), ... , (c_m, d_m)(c1,d1),(c2,d2),...,(cm,dm), of bicycles 1,2,...,m 1, 2, ... , m1,2,...,m, respectively, which are separated by a space. The third line contains the coordinates,(a1,b1),(a2,b2),...,(an,bn)(a1, b1), (a2, b2), ... , (an, bn)(a1,b1),(a2,b2),...,(an,bn), of users 1,2,...,n1, 2,... , n1,2,...,n, respectively, which are separated by a space. contains the thresholds, s1,s2,...,sns_1, s_2, ... , s_ns1,s2,...,sn, of the nnn users. The last test case is followed by a line of two 000s. All the number of coordinate in the input is in the range

转载于:https://www.cnblogs.com/smallocean/p/8729348.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值