CF1578F.Framing Pictures

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 nn (3≤n≤200 0003 \le n \le 200\,000) — the number of vertices. The remaining nn lines each contain two integers xx and yy (−109≤x,y≤109-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.

输入描述了一种生命体的形状,该形状是一个二维凸多边形。

输入的第一行包含一个整数 nn(3≤n≤200 0003 \le n \le 200\,000),表示顶点的数量。接下来的 nn 行每行包含两个整数 xx 和 yy(−109≤x,y≤109-10^9 \le x, y \le 10^9),表示一个顶点的坐标。顶点按逆时针顺序给出,且任意三个顶点不共线。

输出格式

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−610^{-6}.

输出一行,包含该多边形外接矩形的期望面积。你的答案的绝对或相对误差应不超过 10−610^{-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.

图片展示了示例生命体以及各种相机朝向。

输入解题思路,AI测评打分。不知道怎么写?

首页