#K59007. Convex Hull Computation
Convex Hull Computation
Convex Hull Computation
You are given a set of n points on the 2D plane. Your task is to compute the vertices of the convex hull that encloses all the points.
The convex hull of a set of points is defined as the smallest convex polygon that contains every point in the set. Formally, if the points are given as \( (x_1,y_1), (x_2,y_2), \ldots, (x_n,y_n) \), you need to output the vertices of the convex hull in clockwise order.
Note: If multiple points lie on the same line segment on the boundary of the hull, include only the extreme points.
inputFormat
The first line of input contains an integer n (\( 3 \leq n \leq 10^5 \)), where n is the number of points.
The following n lines each contain two space-separated integers x and y (\( -10^9 \le x, y \le 10^9 \)), representing the coordinates of a point.
outputFormat
Output the vertices of the convex hull in clockwise order. The first line should contain an integer m, the number of vertices in the convex hull.
The next m lines should each contain two space-separated integers, representing the x and y coordinates of a vertex.
## sample8
0 3
1 1
2 2
4 4
0 0
1 2
3 1
3 3
4
0 0
3 1
4 4
0 3
</p>