AtCoder Beginner Contest 220
翻译中…
Problem Statement
翻译中…
In the $xy$-plane, we have $N$ points, each assigned a weight.
The $i$-th point has the coordinates $(X_i,Y_i)$ and the weight $C_i$.
翻译中…
We will choose four of the $N$ points to form an isosceles trapezoid whose vertices are the chosen points.
What is the maximum possible total weight of the points chosen here?
翻译中…
If it is impossible to form an isosceles trapezoid, print -1.
翻译中…
We remind you that an isosceles trapezoid is a quadrilateral that satisfies all of the following conditions.
翻译中…
- It is a trapezoid.
- For one of the two parallel sides, the two angles at its ends are equal.
翻译中…
Constraints
翻译中…
$4 \leq N \leq 1000$$-10^9 \leq X_i,Y_i \leq 10^9$$1 \leq C_i \leq 10^9$$(X_i,Y_i) \neq (X_j,Y_j)$if$i \neq j$.- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
X_1 Y_1 C_1
X_2 Y_2 C_2
\vdots
X_N Y_N C_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
5
0 3 10
3 3 10
-1 0 10
2 0 10000
4 0 10
Output #1
40

We can choose Points $1, 2, 3, 5$ to form an isosceles trapezoid, with the points having a total weight of $40$.
Any other way to choose points would not form an isosceles trapezoid.
Input #2
6
0 1 1
1 4 20
2 7 300
5 6 4000
4 3 50000
3 0 600000
Output #2
650021

Note that a square and a rectangle are also isosceles trapezoids.
Input #3
7
-3 0 1
-2 0 1
-1 0 1
0 0 1
1 0 1
2 0 1
3 0 1
Output #3
-1
We cannot form an isosceles trapezoid.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。