Shootout!
Practice
3.7 (178 votes)
Geometry
Hiring
Approved
Easy
Problem
39% Success 3295 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

A and B are police while C and D are thieves. A and C are shooting at each other while B and D at each other. Now given the co-ordinates of all four, you have to find whether a "Bullet Path" problem can occur or not. Now a "Bullet Path" problem is caused when the paths A-C and B-D do not cross properly or do not cross at all or when A, B, C and D lie on the same line. There are some tactical reasons why the path should cross in a proper way. The paths do not cross properly means that one of the police/thieves is on the crossing point itself.

Crossing paths

Given the points, print "Yes"(without quotes) if "Bullet Path" problem can occur, "No"(without quotes) if not.

Input format:
The first line contains T, the number of test cases. For each test case, there will be four lines, each containing two space separated integers denoting the X and Y co-ordinates of the A, B, C and D respectively.

Output Format:
For each test case print a single line containing the answer.

Constraints:
1 <= T <= 104
-105 <= X,Y <= 105

Note: During some calculations the integers may not fit in 64bit data types. Please be careful with some languages.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
40 votes
Tags:
ApprovedData StructuresFenwick TreeHardOpenSegment TreesTrees
Points:30
1 votes
Tags:
Grammar-VerifiedOpenRecruitApprovedGrammar-VerifiedOpenRecruitApprovedGrammar-VerifiedSegment TreesHardAdvanced Data StructuresData StructuresMathematicsSegment tree
Points:20
97 votes
Tags:
ImplementationReadyApprovedEasy