QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#2950. 培育史莱姆

Estadísticas

Oobleck 是一种神奇的魔法物质——将其置于阳光下,它会以不断扩大的圆形生长。如果两个圆接触,它们会神奇地合并成一个圆,新圆的面积等于两个圆的面积之和,圆心位于两个相交圆圆心的中点。新圆的扩张速率为两个碰撞圆中较大的扩张速率。图 F.1 和 F.2 展示了一个例子。

图 F.1:圆 A 圆心为 (10, 10),半径为 6,面积为 36π;圆 B 圆心为 (24, 10),半径为 8,面积为 64π。

图 F.2:合并后,它们被圆 C 取代,圆 C 圆心为 (17, 10),半径为 10,面积为 100π。

新圆产生后,它可能会与其他现有圆相交,从而引发连锁合并反应。这种由一次相交引发的一次或多次合并的组合在技术上被称为“ooblection”。尽管 ooblection 可能包含一系列合并,但它们在初始相交的瞬间瞬时发生。如果三个或更多的圆参与合并,结果圆的圆心位于所有参与合并的圆的圆心平均值处,结果面积为所有参与合并的圆的面积之和。ooblection 结束后,最终圆的扩张速率为参与该过程的所有圆中最大的扩张速率。

图 F.3:五圆 ooblection。

图 F.3 展示了一个五圆 ooblection 的例子(在样例输入 2 中描述)。在时间 $t = 1$ 时,圆已扩张到图 F.3a 所示的点。此时,圆 A 和圆 B 合并形成圆 F(图 F.3b)。圆 F 与圆 C 和圆 D 相交,合并形成圆 G(图 F.3c)。最后,圆 G 与圆 E 相交,形成最终的圆 H(图 F.3d)。所有这些都发生在时间 $t = 1$。圆 H 的扩张速率等于圆 A 到圆 E 的最大扩张速率(使用样例输入 2 中的值,此最大增长速度为 2)。

最终,随着任何一组圆的生长,它们最终都会合并成一个圆。你的任务是找出该圆产生瞬间的位置和面积。

输入格式

输入序列以一个正整数 $n$ ($n \le 100$) 开头,表示圆的数量。接下来有 $n$ 行,每行对应一个圆。每行包含 4 个数字:$x, y, r$ 和 $s$。$x$ 和 $y$ ($-10^9 \le x, y \le 10^9$) 指定圆心的位置;$r$ ($1 \le r \le 10^6$) 是圆的初始半径;$s$ ($1 \le s \le 10^6$) 是圆的扩张速率。输入中给出的任意两个圆均不相交。在任何时刻,最多只有一个 ooblection 开始,且每个 ooblection 都始于恰好两个圆的接触。

输出格式

输出两行。第一行包含两个数字 $x, y$,表示最终圆产生瞬间的圆心位置。第二行包含该圆的半径。你的答案应精确到相对或绝对误差 $10^{-6}$ 以内。

样例

样例输入 1

2
1 1 1 1
5 1 1 1

样例输出 1

3.00000000 1.00000000
2.82842712

样例输入 2

5
3 4 5 1
17 4 7 1
10 -13 6 2
10 21 7 1
-7 4 1 1

样例输出 2

1.50000000 4.00000000
15.23154621

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.