QOJ.ac

QOJ

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

#17662. Kevin and Geometry

統計

Kevin は長さ $a_1, a_2, \dots, a_n$ の $n$ 本の棒を持っている。

Kevin はこれらの中から 4 本の棒を選び、正の面積を持つ等脚台形* を作りたいと考えている。長方形や正方形も等脚台形とみなすことに注意せよ。Kevin が解を見つけるのを手伝いなさい。解が存在しない場合は $-1$ を出力せよ。

入力

各テストケースは複数のテストケースを含む。最初の行にはテストケースの数 $t$ ($1 \le t \le 10^4$) が含まれる。

各テストケースの説明は以下の通りである。

各テストケースの最初の行には、整数 $n$ ($4 \le n \le 2 \cdot 10^5$) が含まれる。

2 行目には、$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

注記

1 つ目のテストケースでは、長さ 5 と 10 の底辺、および長さ 5 の 2 つの脚を持つ等脚台形を作ることができる。

2 つ目のテストケースでは、長さ 5 の 2 つの底辺と長さ 10 の 2 つの脚を持つ等脚台形を作ることができる。ここでは長方形も等脚台形とみなされる。

3 つ目のテストケースでは、同じ長さの棒が存在しない。等脚台形を作ることは不可能である。

4 つ目のテストケースでは、正の面積を持つ等脚台形を作ることは不可能である。

  • 等脚台形とは、対辺の一組を二等分する対称軸を持つ凸四角形のことである。任意の等脚台形において、2 つの対辺(底辺)は平行であり、残りの 2 つの辺(脚)は等しい長さを持つ。

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.