308804: CF1578F. Framing Pictures

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Framing Pictures

题意翻译

金星上发现了生命!并且这个生命体的形状是一个凸多边形。一个国际财团正在设计一个发往金星的探测器去拍照,但是他们需要估计发送回照片所需的带宽。 当探测器拍下了这个生命体的照片并希望将它发回地球时,所需带宽正比于边界框的大小(即 *bounding box*,边平行于坐标轴,面积最小且能覆盖这个生命体的矩形)。生命体的形状和大小都是已知的,但是它相对于相机的角度是随机的。因此你必须确定对于所有拍摄角度,边界框面积的期望(平均值)。 输入中,生物体形状的描述是在二维上的。 第一行包含一个整数 $n\ (3\le n\le 200\ 000)$,表示顶点个数。接下来 $n$ 行每行两个整数 $x$ 和 $y\ (-10^9\le x,y\le 10^9)$,表示每个顶点的坐标。这些顶点按逆时针顺序给出,并且保证任意三点不共线。 输出一行一个整数,表示边界框的期望面积。你的答案与标准答案的绝对误差或相对误差不能超过 $10^{-6}$。 这幅图片说明了生命体和不同的相机角度。

题目描述

Life has been discovered on Venus! What is more, the life forms appear to be convex polygons. An international consortium is designing a probe to send to Venus to take pictures, but they need to estimate the bandwidth needed to send back pictures. When the probe takes a picture of a life form and wishes to send it back to Earth, the bandwidth required is proportional to the area of the bounding box (in other words, the smallest axis-aligned rectangle that contains the life-form). The shape and size of the life forms are known, but the orientation relative to the camera is random. You must thus determine the expected (average) area of the bounding box across all orientations.

输入输出格式

输入格式


The input describes the shape of a life form as a convex polygon in two dimensions. The first line of input contains an integer $ n $ ( $ 3 \le n \le 200\,000 $ ) — the number of vertices. The remaining $ n $ lines each contain two integers $ x $ and $ y $ ( $ -10^9 \le x, y \le 10^9 $ ) — the coordinates of a vertex. The vertices are given in counterclockwise order, and no three vertices lie on a straight line.

输出格式


Output a single line containing the expected area of the bounding box of the polygon. Your answer should have an absolute or relative error of at most $ 10^{-6} $ .

输入输出样例

输入样例 #1

4
0 0
10 0
10 10
0 10

输出样例 #1

163.661977237

输入样例 #2

5
0 0
10 0
15 8
5 20
-5 7

输出样例 #2

365.666028588

说明

The pictures show example life forms and various camera orientations. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1578F/7bf5484b8f790ebf466874683ff7667e104e8a6b.png) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1578F/7e42566134414108c937e1e5ff26ff9d1b86c9db.png)

Input

题意翻译

金星上发现了生命!并且这个生命体的形状是一个凸多边形。一个国际财团正在设计一个发往金星的探测器去拍照,但是他们需要估计发送回照片所需的带宽。 当探测器拍下了这个生命体的照片并希望将它发回地球时,所需带宽正比于边界框的大小(即 *bounding box*,边平行于坐标轴,面积最小且能覆盖这个生命体的矩形)。生命体的形状和大小都是已知的,但是它相对于相机的角度是随机的。因此你必须确定对于所有拍摄角度,边界框面积的期望(平均值)。 输入中,生物体形状的描述是在二维上的。 第一行包含一个整数 $n\ (3\le n\le 200\ 000)$,表示顶点个数。接下来 $n$ 行每行两个整数 $x$ 和 $y\ (-10^9\le x,y\le 10^9)$,表示每个顶点的坐标。这些顶点按逆时针顺序给出,并且保证任意三点不共线。 输出一行一个整数,表示边界框的期望面积。你的答案与标准答案的绝对误差或相对误差不能超过 $10^{-6}$。 这幅图片说明了生命体和不同的相机角度。

加入题单

算法标签: