QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#21883. Prism Palace (Love Qiwen Xu ver.)

Statistics

我们称一个实数多重集 $S$ 是酷的(cool),当且仅当存在 $x \in S$,使得 $\sum_{y \in S} y = 2x$。

小 D 想用她拥有的两个平行平面 $A(z = 0)$ 和 $B(z = 10^9)$ 建造一座棱柱宫殿。为了完成建造,她从小 N 那里借了一个由 $n$ 个点组成的多边形 $P$。她在两个平面上各放置一个与 $P$ 相同的多边形,但在确定这两个多边形的位置时,不允许旋转。换句话说,这两个多边形必须与 $P$ 全等,且必须能够通过平移(而不旋转)重合。

这两个多边形在它们之间共同构成了一个棱柱形状的宫殿。设该棱柱的各个侧面垂直投影到平面 $A$ 上的面积分别为 $S_1, S_2, \dots, S_n$,你需要求出多重集 $\{S_i\}$ 是“酷的”的概率。

保证该多边形是凸多边形,即多边形的每个内角都小于 $\pi$。

输入格式

输入的第一行包含一个整数 $n$ ($3 \le n \le 2 \times 10^5$),表示多边形 $P$ 的顶点数。

接下来的 $n$ 行,每行包含两个整数 $(x_i, y_i)$,表示多边形 $P$ 的顶点。保证 $|x_i|, |y_i| \le 10^9$。

多边形 $P$ 是通过连接 $(x_i, y_i)$ 和 $(x_{i \bmod n + 1}, y_{i \bmod n + 1})$ 构成的,其中 $1 \le i \le n$。

输出格式

输出仅包含一个实数,表示你的答案。

设你的输出为 $u$,标准答案为 $p$,当且仅当 $\frac{|u-p|}{\max(1,p)} \le 10^{-6}$ 时,你的输出才会被判定为正确。

样例

输入样例 1

3
0 0
1 0
0 1

输出样例 1

1.000000000000000

输入样例 2

4
0 0
0 1
1 1
1 0

输出样例 2

0.000000000000000

输入样例 3

4
0 0
0 3
1 2
1 1

输出样例 3

0.500000000000000

说明

对于样例一,你可以发现无论这两个多边形的位置如何,三个投影面积中最大的一个总是等于另外两个的和,因此答案是 100%,即 1.0。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.