Багров Александр Михайлович, 317 группа ConvexPolygon 5270
Софья Есауленко, группа 319/2 ConvexPolygon 5600
f1from math import *f1from math import *
22
n3def is_convex_polygon(points):n3def is_convex_polygon(pairs):
4    n = len(points)4    n = len(pairs)
5    sign = 05    sym = 0
6    center = (sum((x for x, _ in points)) / len(points), sum((y for _, y6    center = (sum((x for x, y in pairs)) / len(pairs), sum((y for x, y i
> in points)) / len(points))>n pairs)) / len(pairs))
7    points.sort(key=lambda p: (atan2(p[1] - center[1], p[0] - center[0])7    pairs.sort(key=lambda p: (atan2(p[1] - center[1], p[0] - center[0]),
>, p))> p))
8    for i in range(n):8    for i in range(n):
n9        o, a, b = (points[i], points[(i + 1) % n], points[(i + 2) % n])n9        o, a, b = (pairs[i], pairs[(i + 1) % n], pairs[(i + 2) % n])
10        cross = (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - 10        cross = (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - 
>o[0])>o[0])
11        if cross != 0:11        if cross != 0:
n12            current_sign = 1 if cross > 0 else -1n12            current_sym = 1 if cross > 0 else -1
13            if sign == 0:13            if sym == 0:
14                sign = current_sign14                sym = current_sym
15            elif sign != current_sign:15            elif sym != current_sym:
16                return False16                return False
17    return True17    return True
n18l = list()n18lst = list()
19while (s := input()):19while (s := input()):
t20    l.append(eval(s))t20    lst.append(eval(s))
21print(is_convex_polygon(l))21print(is_convex_polygon(lst))
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op