Segment Intersection 1
InterviewTime limit0.25sMemory limit512 MB
Given the integer endpoints of two segments, decide whether the segments intersect, using orientation tests with no three input points collinear.
- Level
Medium5 of 10
- Topics
- Geometry, Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
Given two line segments and on the two-dimensional coordinate plane, determine whether the two segments intersect.
The endpoints of are and , and the endpoints of are and .
Input
The first line gives the endpoints of , and the second line gives the endpoints of . No three points lie on the same line.
Output
Print 1 if and intersect, and 0 otherwise.
Constraints
- are integers.
- The length of each segment is greater than 0.