CUTPOLY
A polygonal line with points in the plane is given.
The points are sorted by
-coordinate, i.e.,
, and also the polygonal line is strictly increasing with respect to
-coordinate, i.e.,
.
Let , and
be lines parallel to the
-axis.
We can bring a line
λ parallel to the
-axis, which intersects the polygonal line at a point (
λ
).
It may intersect at any of the
points given or it may intersect any of the
line segments formed.
Let
(λ) be the area enclosed by the polygonal line, the line
, and the line
λ.
Let
(λ) be the area enclosed by the polygonal line, the line
, and the line
λ.
The task is to determine the minimum value of (λ)
(λ).
Input
The first line of the input contains only the integer , the number of points of the polygonal line.
Each of the next
lines contains a pair of integers separated by a space, corresponding to the
and
coordinates respectively of each point of the line.
The points will be given sorted by the
dimension.
Output
The output should consist of a real number, the minimum possible value of (λ) +
(λ), with an accuracy of
decimal places.
Attention! Be sure to print with "%0.6lf\n" or something similar.
Constraints
.
Execution time limit: 1 sec.
Memory limit: 64 MB.
Example of Input - Output
STDIN (cutpoly.in)
4
1 1
3 2
8 5
9 7
STDOUT (cutpoly.out)
12.833333
Comments