E(length(CH))
Time limit2sMemory limit256 MB
Given n points where each point is activated with probability p, find the expected perimeter of the convex hull of the activated points.
- Level
Medium7 of 10
- Topics
- Probability, Geometry, Sorting
- Solved
- No attempts yet
Statement
You are given points on a plane. The -th point is activated with probability . Find the expected circumference of the convex hull of the activated points.

Input
The first line contains the number of points and the number . Every point is activated with probability , except the first three, which are always activated (). This way, the convex hull circumference is always defined. Each of the next lines contains the coordinates and of the -th point, separated by a space.
Output
Print the expected circumference of the convex hull. Your answer is accepted if it differs from the reference solution by less than .
Constraints
;
;
No three points are collinear. No two points share an or coordinate.