#abc304c. C - Virus

C - Virus

Score : 300300 points

问题描述

在二维平面上有 NN 名编号为 1,2,,N1, 2, \ldots, N 的人,其中第 ii 个人位于坐标 (Xi,Yi)(X_i,Y_i) 表示的点上。

11 个人已被病毒感染。该病毒会传播到距离感染者 DD 范围内的其他人。

此处的距离定义为欧几里得距离,即对于两点 (a1,a2)(a_1, a_2)(b1,b2)(b_1, b_2),这两点之间的距离为 (a1b1)2+(a2b2)2\sqrt{(a_1-b_1)^2 + (a_2-b_2)^2}

经过足够长的时间后,也就是说,如果第 ii 个人被感染,那么距离他 DD 范围内的所有人都会被病毒感染。请确定对于每个 ii,第 ii 个人是否被病毒感染。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

There are NN people numbered 1,2,,N1, 2, \ldots, N on a two-dimensional plane, and person ii is at the point represented by the coordinates (Xi,Yi)(X_i,Y_i).

Person 11 has been infected with a virus. The virus spreads to people within a distance of DD from an infected person.

Here, the distance is defined as the Euclidean distance, that is, for two points (a1,a2)(a_1, a_2) and (b1,b2)(b_1, b_2), the distance between these two points is (a1b1)2+(a2b2)2\sqrt {(a_1-b_1)^2 + (a_2-b_2)^2}.

After a sufficient amount of time has passed, that is, when all people within a distance of DD from person ii are infected with the virus if person ii is infected, determine whether person ii is infected with the virus for each ii.

Constraints

  • 1N,D20001 \leq N, D \leq 2000
  • 1000Xi,Yi1000-1000 \leq X_i, Y_i \leq 1000
  • (Xi,Yi)(Xj,Yj)(X_i, Y_i) \neq (X_j, Y_j) if iji \neq j.
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN DD

X1X_1 Y1Y_1

X2X_2 Y2Y_2

\vdots

XNX_N YNY_N

Output

Print NN lines. The ii-th line should contain Yes if person ii is infected with the virus, and No otherwise.

Sample Input 1

4 5
2 -1
3 1
8 8
0 5

Sample Output 1

Yes
Yes
No
Yes

The distance between person 11 and person 22 is 5\sqrt 5, so person 22 gets infected with the virus.
Also, the distance between person 22 and person 44 is 55, so person 44 gets infected with the virus.
Person 33 has no one within a distance of 55, so they will not be infected with the virus.

Sample Input 2

3 1
0 0
-1000 -1000
1000 1000

Sample Output 2

Yes
No
No

Sample Input 3

9 4
3 2
6 -1
1 6
6 5
-2 -3
5 3
2 -3
2 1
2 6

Sample Output 3

Yes
No
No
Yes
Yes
Yes
Yes
Yes
No

update @ 2024/3/10 08:33:36