QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓

#11012. 传送门

统计

Alice 和 Bob 住在“矩形王国”中。世界上有两个传送门。站在传送门处,人们可以跳进去,并瞬间传送到另一个传送门。传送门在使用后不会消失。当然,你也可以路过传送门而不跳进去,但为什么要浪费这种乐趣呢?

众所周知,Bob 与 Alice 约会过于频繁,以至于“矩形王国”里的几乎每个人都感到嫉妒,并想做些坏事来阻止他们见面。例如,你想要通过将他们的公寓搬到尽可能远的地方来分开他们。希望在你的计划之后,Bob 需要花费更多的努力才能走到 Alice 的公寓,这会让他感到不情愿,直到最终他们不再见面,每个人都再次感到快乐。

你可以假设“矩形王国”是一个二维矩形,Alice 和 Bob 的公寓必须位于该矩形内。距离为欧几里得距离,走一个单位距离需要一个单位时间。Bob 总是选择从他的公寓到 Alice 公寓的最短路径。

输入格式

第一行是一个整数 $T$,表示测试用例的数量。

接下来的 $T$ 行,每行包含六个空格分隔的整数 $A, B, X_1, Y_1, X_2, Y_2$。$A$ 和 $B$ 分别表示王国的宽度和高度,该王国由四个点定义:$(0, 0), (0, B), (A, B), (A, 0)$。$(X_1, Y_1)$ 和 $(X_2, Y_2)$ 表示两个传送门的位置。

$1 \le T \le 2000$ $1 \le A, B \le 10^3$ $0 \le X_1, X_2 \le A$ $0 \le Y_1, Y_2 \le B$

输出格式

对于每个测试用例,输出一行包含“Case #x:”,其中 $x$ 是测试用例编号。接下来的两行分别输出“ax ay”和“bx by”,表示在你邪恶地移动他们的公寓后,Alice 公寓和 Bob 公寓的位置。Bob 到 Alice 公寓的最短路径的行走时间应当最大化。

如果你的答案的绝对误差或相对误差不超过 $10^{-6}$,则被认为是正确的。即,设你的答案的行走时间为 $a$,裁判答案的行走时间为 $b$,如果 $\frac{|a-b|}{\max(1, |b|)} \le 10^{-6}$,则你的答案被认为是正确的。

样例

输入 1

2
2 2 0 0 2 2
2 2 0 0 0 2

输出 1

Case #1:
2.00000000 0.00000000
0.00000000 2.00000000
Case #2:
2.00000000 0.00000000
0.50000000 2.00000000

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.