#P15056. [UOI 2023 II Stage] Unenslaved puppy

[UOI 2023 II Stage] Unenslaved puppy

题目描述

A dog was attacked by angry bees. To hide from them, kind smurfs built nn domes.

Mathematically a dome is a semicircle with center at point (posi,0)(pos_i,0) and radius rir_i. It is impossible to pass through the wall of the dome. The dog and the beehive can be represented as two points (x1,y1)(x_1,y_1) and (x2,y2)(x_2,y_2). If a point is inside the dome, we consider it to be inside.

Help the dog find out whether it is safe. That is, whether the bees can reach the dog without crossing the walls of domes.

:::align{center} :::

输入格式

The first line contains five integers nn, x1x_1, y1y_1, x2x_2, y2y_2 (1n103,0x1,y1,x2,y2103)(1 \le n \le 10^3, 0 \le x_1,y_1,x_2,y_2 \le 10^3).

Each of the following nn lines contains two integers posipos_i and rir_i (0posi103,1ri103)(0 \le pos_i \leq 10^3, 1 \leq r_i \le 10^3).

输出格式

If the bees can reach the dog without crossing the walls of domes, print YES\tt{YES}.

Otherwise, in the first line print NO\tt{NO}, and in the second line print the smallest index (starting from one) of the dome that separates the bee and the dog.

3 2 1 2 2
2 1
3 2
3 1
NO
1
2 1 1 3 0
2 2
3 1
NO
2
2 2 1 4 1
3 2
3 1
YES

提示

Explanation for the first test:

:::align{center} :::

Explanation for the second test:

:::align{center} :::

Explanation for the third test:

:::align{center} :::