#K75597. Splash Overlap Detection

    ID: 34454 Type: Default 1000ms 256MiB

Splash Overlap Detection

Splash Overlap Detection

You are given a set of water drops, where each drop produces a circular splash on the ground. The splash of a drop, centered at \( (x_i, y_i) \) with radius \( r_i \), forms a circle. Your task is to determine if there exists at least one pair of drops whose splashes overlap. Two splashes are considered to overlap if the Euclidean distance between their centers is less than or equal to the sum of their radii, i.e., if \( \sqrt{(x_i - x_j)^2 + (y_i - y_j)^2} \leq r_i+r_j \).

The input data starts with an integer \( n \) denoting the number of water drops, followed by \( n \) lines each containing three numbers: \( x_i \), \( y_i \) and \( r_i \). Output YES if any two splashes overlap, otherwise output NO.

Note: Use precise floating point calculations as needed.

inputFormat

Standard input (stdin) contains multiple lines. The first line consists of a single integer \( n \) (1 \( \leq n \leq 10^5 \)), representing the number of water drops. The following \( n \) lines each contain three space-separated numbers \( x_i, y_i, r_i \) where \( (x_i,y_i) \) are the coordinates of the drop's center and \( r_i \) is its splash radius.

outputFormat

Output a single line to standard output (stdout) — YES if there exists at least one pair of overlapping splashes, and NO otherwise.

## sample
3
1 1 2
4 4 1
2 2 1
YES