atcoder#ABC220G. [ABC220G] Isosceles Trapezium
[ABC220G] Isosceles Trapezium
Score : points
Problem Statement
In the -plane, we have points, each assigned a weight. The -th point has the coordinates and the weight .
We will choose four of the 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
- if .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
5
0 3 10
3 3 10
-1 0 10
2 0 10000
4 0 10
40
We can choose Points to form an isosceles trapezoid, with the points having a total weight of . Any other way to choose points would not form an isosceles trapezoid.
6
0 1 1
1 4 20
2 7 300
5 6 4000
4 3 50000
3 0 600000
650021
Note that a square and a rectangle are also isosceles trapezoids.
7
-3 0 1
-2 0 1
-1 0 1
0 0 1
1 0 1
2 0 1
3 0 1
-1
We cannot form an isosceles trapezoid.