Do the segments intersect - 1
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given four points (A), (B), (C), and (D), it is guaranteed that no three of these points are collinear.
Determine whether the line segments (AB) and (CD) intersect.
Input
The input consists of exactly three groups, each containing two lines (a total of six lines). The first line of each group provides the coordinates of segment (AB) in the format: (A_x) (A_y) (B_x) (B_y). The second line of each group provides the coordinates of segment (CD) in the format: (C_x) (C_y) (D_x) (D_y). All coordinates are integers, with absolute values not exceeding one million.
Output
For each group, output YES on a separate line if the segments intersect, or NO if they do not.
Examples
Input #1
Answer #1
Submissions 157
Acceptance rate 28%