用户输出
Yes
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#2495 | #1003. 凸多边形 | Accepted | 100 | 946 ms | 2968 K | Python 3 / 887 B | ywhzhi | 2023-11-18 17:09:24 |
def cross_product(v1, v2):
return v1[0] * v2[1] - v1[1] * v2[0]
def vector_direction(v1, v2):
cross = cross_product(v1, v2)
return 1 if cross > 0 else -1 if cross < 0 else 0
def is_convex_quad(A, B, C, D):
AB = (B[0] - A[0], B[1] - A[1])
BC = (C[0] - B[0], C[1] - B[1])
CD = (D[0] - C[0], D[1] - C[1])
DA = (A[0] - D[0], A[1] - D[1])
directions = [
vector_direction(AB, BC),
vector_direction(BC, CD),
vector_direction(CD, DA),
vector_direction(DA, AB)
]
return all(direction >= 0 for direction in directions) or all(direction <= 0 for direction in directions)
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
C = tuple(map(int, input().split()))
D = tuple(map(int, input().split()))
if is_convex_quad(A, B, C, D):
print("Yes")
else:
print("No")
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
Yes
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0
用户输出
No
系统信息
Exited with return code 0