CF54E.Vacuum Сleaner

省选/NOI-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

One winter evening the Hedgehog was relaxing at home in his cozy armchair and clicking through the TV channels. Stumbled on an issue of «TopShop», the Hedgehog was about to change the channel when all of a sudden he was stopped by an advertisement of a new wondrous invention.

Actually, a vacuum cleaner was advertised there. It was called Marvellous Vacuum and it doesn't even need a human to operate it while it cleans! The vacuum cleaner can move around the flat on its own: it moves in some direction and if it hits an obstacle there, it automatically chooses a new direction. Sooner or later this vacuum cleaner will travel through all the room and clean it all. Having remembered how much time the Hedgehog spends every time on cleaning (surely, no less than a half of the day), he got eager to buy this wonder.

However, the Hedgehog quickly understood that the cleaner has at least one weak point: it won't clean well in the room's corners because it often won't able to reach the corner due to its shape. To estimate how serious is this drawback in practice, the Hedgehog asked you to write for him the corresponding program.

You will be given the cleaner's shape in the top view. We will consider only the cases when the vacuum cleaner is represented as a convex polygon. The room is some infinitely large rectangle. We consider one corner of this room and want to find such a rotation of the vacuum cleaner so that it, being pushed into this corner, will leave the minimum possible area in the corner uncovered.

一个冬夜,刺猬正舒适地坐在自家的扶手椅中,漫无目的地切换着电视频道。当他偶然看到一档名为《顶尖商店》(TopShop)的节目时,正准备换台,却突然被一则新奇发明的广告所吸引而停了下来。

实际上,广告中介绍的是一款吸尘器。它被命名为“奇妙吸尘器”(Marvellous Vacuum),甚至无需人为操作即可自行清洁!该吸尘器可在房间内自主移动:它沿某一方向行进,若碰到障碍物,则自动选择一个新的行进方向。最终,这台吸尘器必将遍历整个房间并完成全部清洁工作。刺猬想起自己每次打扫房间所耗费的时间(当然,绝不少于半天),顿时萌生了购买这一神奇设备的强烈愿望。

然而,刺猬很快意识到,这款吸尘器至少存在一个缺陷:由于自身形状的限制,它往往无法有效清洁房间的角落,导致角落区域清洁不彻底。为了评估这一缺陷在实际应用中的严重程度,刺猬请你为他编写一个相应的程序。

你将获得该吸尘器俯视图下的形状。我们仅考虑吸尘器被表示为一个凸多边形的情形。房间是一个无限大的矩形。我们关注该房间的一个直角角落,并希望找到一种吸尘器的旋转方式,使得当它被推入该角落时,在角落内未被覆盖的面积最小。

输入格式

The first line contains an integer N which represents the number of vertices of the vacuum cleaner's polygon (3 ≤ N ≤ 4·104). Then follow N lines each containing two numbers — the coordinates of a vertex of the polygon. All the coordinates are integer and their absolute values do not exceed 106.

It is guaranteed that the given polygon is nondegenerate and convex (no three points lie on the same line). The polygon vertices are given in a clockwise or counter-clockwise direction.

第一行包含一个整数 NN,表示吸尘器多边形的顶点数(3≤N≤4⋅1043 \leq N \leq 4\cdot10^4)。接下来有 NN 行,每行包含两个数字——多边形一个顶点的坐标。所有坐标的绝对值均不超过 10610^6,且均为整数。

保证所给多边形是非退化的且为凸多边形(任意三点不共线)。多边形的顶点按顺时针或逆时针顺序给出。

输出格式

Print the minimum possible uncovered area. The answer will be accepted if it is within 10 - 6 of absolute or relative error from the correct answer.

输出最小可能的未覆盖面积。只要答案与正确答案的绝对或相对误差在 10−610^{-6} 范围内,即视为正确。

输入输出样例

  • 输入#1

    4
    0 0
    1 0
    1 1
    0 1

    输出#1

    0.00000000000000000000
  • 输入#2

    8
    1 2
    2 1
    2 -1
    1 -2
    -1 -2
    -2 -1
    -2 1
    -1 2

    输出#2

    0.50000000000000000000

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

首页