Shooter
Medium
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
The shooter needs to hit n targets, but he has only one bullet left. Determine whether he can find such a point (not necessarily with integer coordinates) and the direction of the shot that a bullet fired from this point in this direction will fly through all the targets.
Input
First line contains one integer n – the number of targets. Each of the next n lines contains 4 integers x[i1]
, y[i1]
, x[i2]
, y[i2]
(-10000 ≤ x[i1]
, y[i1]
, x[i2]
, y[i2]
≤ 10000) – the starting and the ending position of the i-th target (the targets are represented as disjoint segments on the plane).
Output
Print one line with a word YES if the solution exists and NO otherwise.
Examples
Input #1
Answer #1
Submissions 157
Acceptance rate 8%