- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1708.py
More file actions
Latest commit
22 lines (12 loc) · 372 Bytes
/
Copy path1708.py
File metadata and controls
22 lines (12 loc) · 372 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
defccw_raw(x1, y1, x2, y2, x3, y3):
returnx1*y2+x2*y3+x3*y1-x2*y1+x3*y2+x1*y3
defccw(p1, p2, p3):
returnccw_raw(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1])
n=int(input())
pts=list()
for_inrange(n):
x, y=map(int, input().split())
pts.append((y,x))
pts.sort()
pts[1:].sort(key=lambdap1, p2: ccw(pts[0], p1, p2))
print(pts)