QOJ.ac

QOJ

时间限制: 2 s 内存限制: 128 MB 总分: 100

#8796. 两块石头

统计

两颗石子位于无限网格的原点 $(0, 0)$。共有 $n$ 种可能的移动方式,每种移动方式不一定唯一,两颗石子可以独立选择移动。每种移动方式由一个整数坐标向量描述。每颗石子对每种移动方式最多只能使用一次,且移动顺序可以任意安排。注意,一颗石子使用某种移动方式并不妨碍另一颗石子在任何时候使用相同的移动方式。

我们的目标是使两颗石子之间的距离(欧几里得距离)尽可能远。请问这个距离的平方是多少?

输入格式

输入的第一行包含一个正整数 $n$,表示可能的移动方式数量。接下来的 $n$ 行,每行包含两个整数 $x_i, y_i$ ($-10^4 \le x_i, y_i \le 10^4$),由空格分隔,构成向量 $[x_i, y_i]$,描述了一种石子的移动方式。

输出格式

程序应输出一个整数到标准输出,即两颗石子之间最大可能距离的平方。

样例

样例输入 1

3
-1 3
-1 -2
4 0

样例输出 1

41

说明

该图展示了一个最优解:第一颗石子进行了向量 $[4, 0]$ 和 $[-1, 3]$ 所代表的移动,而第二颗石子进行了向量 $[-1, -2]$ 所代表的一次移动。

子任务

测试集由以下子任务组成。每个子任务内可能包含多个测试点。

子任务 数据范围 分值
1 $n \le 20$ 15
2 $n \le 2000$ 45
3 $n \le 200\,000$ 40

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.