QOJ.ac

QOJ

Time Limit: 10 s Memory Limit: 512 MB Total points: 100

#7336. 工厂

Statistics

“ASD Inc.” 是一家全球性的四轴飞行器制造商。他们最近决定建造一座新工厂,用于生产全新的四轴飞行器系列。然而,公司尚未决定工厂的选址。

工厂应选址在使得将生产的四轴飞行器运送到各商店的成本最小化的位置。共有 $n$ 家商店对销售该新机型感兴趣。生产出的四轴飞行器将自行飞往商店,每一架都从工厂直线飞往其选定的商店。如果工厂与某家商店之间的欧几里得距离为 $x$,则每月的运输成本恰好为 $x$ 比特币。

工厂可以建在任何地方,即使该位置已经有商店(在这种情况下,运输成本为零)。给定各商店的坐标,请找到建造工厂的最佳位置。

输入格式

输入的第一行包含测试用例的数量 $z$ ($1 \le z \le 10$)。接下来是各测试用例的描述。

每个测试用例的第一行包含商店的数量 $n$ ($2 \le n \le 1000$)。

接下来的 $n$ 行,每行包含两个整数 $x, y$ ($-10^6 \le x, y \le 10^6$),表示商店的坐标。

你可以假设没有两家商店位于同一个位置。

输出格式

对于每个测试用例,输出两个数字,表示使到各商店的距离之和最小的点的坐标。如果存在多个这样的点,输出其中任意一个即可。

如果最优解的成本为 $x$,则成本为 $y$ 的解在满足 $\frac{|y-x|}{x} < 10^{-6}$ 时被视为正确。

样例

样例输入 1

1
3
-3 0
0 3
3 0

样例输出 1

0.000000 1.732051

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.