AlgoUniversity
  • Go Back
Discussion
Non Degenerate Triangle :

Author

Akshay Sharma

Difficulty Level : Easy

Submissions : 164

Asked In : Salesforce

Marks :100

: 1 | : 0

Given 3 points a(x1,y1), b(x2, y2), c(x3, y3) check if they form a non-degenerate triangle or not. If they do form a triangle then check if points p(xp, yp) and q(xq, yq) lie inside or on the triangle.

Input

The first line of input contains coordinates of a(x1,y1)($$$0\le a \le 10^5$$$).

The second line of input contains coordinates of b(x2,y2)($$$0\le b \le 10^5$$$).

The third line of input contains coordinates of c(x3,y3)($$$0\le c \le 10^5$$$).

The fourth line of input contains coordinates of p(xp,yp)($$$0\le p \le 10^5$$$).

The fifth line of input contains coordinates of q(xq,yq)($$$0\le q \le 10^5$$$).

Output

Print the following

0 if triangle is non degenrate

1 if p is inside triangle and q is not

2 if q is inside triangle and p is not

3 if p,q are inside triangle

4 if none are inside

Examples

Input
0 0
100 0
0 200
12 21
21 21
Output
3
Input
0 0
1 1
2 2
12 21
21 21
Output
0

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.