QOJ.ac

QOJ

Time Limit: 6 s Memory Limit: 1024 MB Total points: 100

#3109. 飞行计划评估

Statistics

在两地之间飞行时,制定一份好的飞行计划非常重要。通常有许多不同的因素需要考虑,其中最重要的是燃油消耗和天气预报(尤其是风向)。在本题中,我们将根据第三个统计指标来评估飞行计划,即飞行过程中有多少是在水面上空,有多少是在陆地上空。这个统计指标本身可能并不重要,但许多乘客似乎更喜欢在陆地上空飞行——要么是因为他们害怕在水面上空飞行,要么仅仅是因为在陆地上空飞行时,景色往往稍微有趣一些。

对于本题,我们假设地球是一个半径为 $6370\text{ km}$ 的完美球体。我们将地球上的每个大陆建模为该球体上的一个多边形——即一个由线段组成的闭合序列,其中两点之间的线段由这两点之间的最短球面弧组成。线段的两个端点不能是同一点,也不能是对跖点(直径相对的点)。类似地,飞行路线被建模为由线段连接的航点序列,但与多边形的线段不同,这些线段可能会自交,且不一定会回到起点。

图 F.1:第二个样例输入

为了简化问题,我们额外做出以下两个假设: 飞行路线的任何航点距离任何海岸线(多边形的一部分线段)都不在 $0.1\text{ km}$ 以内。 任何大陆多边形的顶点距离飞行路线都不在 $0.1\text{ km}$ 以内。

球体上的所有坐标均表示为一对纬度和经度(单位均为度)。纬度 $\pm 90$ 的点是北极/南极,纬度 $0$ 的点是赤道上的点。

输入格式

输入包含: 一行包含一个整数 $1 \le c \le 30$,表示大陆的数量; $c$ 行,每行描述一个大陆。每行以一个整数 $3 \le n \le 30$ 开头,表示描述该大陆的多边形的顶点数。随后是 $n$ 对整数 $\phi_1, \lambda_1, \dots, \phi_n, \lambda_n$,其中 $-90 \le \phi_i \le 90$ 且 $0 \le \lambda_i \le 359$,表示大陆第 $i$ 个顶点的纬度和经度; * 一行描述飞行计划。该行以一个整数 $2 \le m \le 30$ 开头,表示航点的数量。随后是 $m$ 对整数 $\phi_1, \lambda_1, \dots, \phi_m, \lambda_m$,其中 $-90 \le \phi_i \le 90$ 且 $0 \le \lambda_i \le 359$,表示航线第 $i$ 个航点的纬度和经度。

大陆不能自交。没有任何大陆会接触或包含其他大陆。大陆以逆时针顺序给出,即如果你从多边形的第一个顶点走到第二个顶点,大陆的内部就在你的左手边。

航线的第一个和最后一个航点始终位于某个大陆内部(但不一定是同一个大陆)。

输出格式

输出两个实数 $l$ 和 $w$,其中 $l$ 是飞行的总长度(单位为 $\text{km}$),$w$ 是飞行过程中在水面上空飞行的百分比。这些数字的绝对误差或相对误差应不超过 $10^{-6}$。

样例

样例输入 1

1
4 -45 0 45 0 45 90 -45 90
5 0 180 0 359 0 160 0 170 0 180

样例输出 1

40023.890406734 25.0000000000

样例输入 2

2
6 62 80 28 49 10 80 37 95 8 134 51 129
3 52 188 29 165 24 188
4 19 77 33 180 69 169 29 75

样例输出 2

21243.902224493 52.066390024

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.