QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#17662. 凯文与几何

Statistics

Kevin 有 $n$ 根长度分别为 $a_1, a_2, \dots, a_n$ 的木棒。

Kevin 想要从中选择 $4$ 根木棒,组成一个面积为正的等腰梯形*。注意,矩形和正方形也被视为等腰梯形。帮助 Kevin 找到一个可行解。如果无解,输出 $-1$。

*等腰梯形是指一条对称轴平分一对对边的凸四边形。在任意等腰梯形中,两对边(底边)平行,另外两边(腰)长度相等。

输入格式

每个测试点包含多个测试用例。第一行包含测试用例的数量 $t$($1 \le t \le 10^4$)。接下来是每个测试用例的描述。

每个测试用例的第一行包含一个整数 $n$($4 \le n \le 2 \cdot 10^5$)。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$($1 \le a_i \le 10^8$)。

保证所有测试用例中 $n$ 的总和不超过 $2 \cdot 10^5$。

输出格式

对于每个测试用例,输出 $4$ 个整数,表示所选木棒的长度。如果无解,输出 $-1$。

如果存在多个解,输出其中任意一个即可。

样例

输入样例 1

7
4
5 5 5 10
4
10 5 10 5
4
1 2 3 4
4
1 1 1 3
6
4 2 1 5 7 1
6
10 200 30 300 30 100
4
100000000 100000000 1 2

输出样例 1

5 5 5 10
5 5 10 10
-1
-1
1 1 4 5
-1
100000000 100000000 1 2

说明

在第一个测试用例中,你可以组成一个底边长度分别为 $5$ 和 $10$,两条腰长度为 $5$ 的等腰梯形。

在第二个测试用例中,你可以组成一个两底边长度为 $5$、两腰长度为 $10$ 的等腰梯形。在这里,矩形被视为等腰梯形。

在第三个测试用例中,没有长度相同的木棒。因此无法组成等腰梯形。

在第四个测试用例中,无法组成一个面积为正的等腰梯形。

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.