P15056 [UOI 2023 II Stage] Unenslaved puppy

Description

A dog was attacked by angry bees. To hide from them, kind smurfs built $n$ domes. Mathematically a dome is a semicircle with center at point $(pos_i,0)$ and radius $r_i$. It is impossible to pass through the wall of the dome. The dog and the beehive can be represented as two points $(x_1,y_1)$ and $(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} ![](https://cdn.luogu.com.cn/upload/image_hosting/grlzymqi.png) :::

Input Format

The first line contains five integers $n$, $x_1$, $y_1$, $x_2$, $y_2$ $(1 \le n \le 10^3, 0 \le x_1,y_1,x_2,y_2 \le 10^3)$. Each of the following $n$ lines contains two integers $pos_i$ and $r_i$ $(0 \le pos_i \leq 10^3, 1 \leq r_i \le 10^3)$.

Output Format

If the bees can reach the dog without crossing the walls of domes, print $\tt{YES}$. Otherwise, in the first line print $\tt{NO}$, and in the second line print the smallest index (starting from one) of the dome that separates the bee and the dog.

Explanation/Hint

Explanation for the first test: :::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/grlzymqi.png) ::: Explanation for the second test: :::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/s34mvpck.png) ::: Explanation for the third test: :::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/c86oo37j.png) :::