40 lines
873 B
Python
40 lines
873 B
Python
def compare(A, B) :
|
|
if A[0] < B[0] :
|
|
return True
|
|
elif A[0] == B[0] :
|
|
return A[1] <= B[1]
|
|
else :
|
|
return False
|
|
|
|
def crossProduct(A, B, C) :
|
|
crossValue = (B[0] - A[0]) * (C[1] - A[1]) - (B[1] - A[1]) * (C[0] - A[0])
|
|
if crossValue > 0 :
|
|
return 1
|
|
elif crossValue < 0 :
|
|
return -1
|
|
else :
|
|
return 0
|
|
|
|
x1, y1, x2, y2 = map(int, input().split())
|
|
x3, y3, x4, y4 = map(int, input().split())
|
|
|
|
A, B, C, D = [x1, y1], [x2, y2], [x3, y3], [x4, y4]
|
|
if not compare(A, B) :
|
|
A, B = B, A
|
|
|
|
if not compare(C, D) :
|
|
C, D = D, C
|
|
|
|
crossABCD = crossProduct(A, B, C) * crossProduct(A, B, D)
|
|
crossCDAB = crossProduct(C, D, A) * crossProduct(C, D, B)
|
|
|
|
ans = 0
|
|
|
|
if crossABCD == 0 and crossCDAB == 0 :
|
|
if compare(A, D) and compare(C, B) :
|
|
ans = 1
|
|
|
|
elif crossABCD <= 0 and crossCDAB <= 0 :
|
|
ans = 1
|
|
|
|
print(ans) |