P15157 [SWERC 2024] Disk Covering

Description

:::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/7lhszhag.png) ::: On a vast, flat green meadow, there are several golden disks in the shape of perfect circles from ancient times. According to legend, if one chants a spell, the area covered by the disks will turn into flames, fending off enemy attacks. When the enemy comes, you can hide in a place completely surrounded by disks, yet not on the disks, thus isolated from the outside world by the flames. Given the positions and sizes of the disks, determine whether such a hiding place exists.

Input Format

The first line contains an integer $N$, representing the number of disks. In the following $N$ lines, the $i^{th}$ line contains three integers that describe disk $i$: the x-coordinate $x_i$, the y-coordinate $y_i$ of its center, and its radius $r_i$.

Output Format

A single integer, $1$ if such a place exists, or $0$ otherwise.

Explanation/Hint

#### Sample Explanation 1 In this sample, there isn’t any place that is completely surrounded by disks, yet not on the disks. :::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/63i79u28.png) ::: #### Sample Explanation 2 In this sample, $(-0.5, 3)$ is one of the places we can hide. It is surrounded by disks, yet not on the disks. Note that although all the inputs are integers, the hiding place does not necessarily have to be an integer point. :::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/gdjfc4j9.png) ::: #### Sample Explanation 3 In this sample, there isn’t any place that is completely surrounded by disks, yet not on the disks. :::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/dizlxbkw.png) ::: #### Limits - $1 \leq N \leq 250$; - $-10^9 \leq x_i, y_i \leq 10^9$ for all $i \leq N$; - $1 \leq r_i \leq 10^9$ for all $i \leq N$; - There are no three disks whose circular outlines intersect at a common point; - Among all intersection points of the circular outlines of any two disks, the distance between any two intersection points is greater than or equal to $1$; - There are no two disks whose circular outlines are tangent to each other (i.e. have exactly one intersection point); - For two disks whose circular outlines do not intersect, the distance between any point on the circular outline of one disk and any point on the circular outline of the other disk is always greater than or equal to $1$.