#P10630. [JOI Open 2017] 推土机 / Bulldozer
[JOI Open 2017] 推土机 / Bulldozer
Problem Description
Translated from JOI Open 2017 T2 「ブルドーザー / Bulldozer」.
There are points on the plane. Point is located at , and its weight is a non-zero integer (it may be negative).
Draw two parallel lines on the plane. The total value is defined as the sum of the weights of all points lying between the two parallel lines (including points on the lines). Find the maximum possible total value.
Input Format
The first line contains an integer .
In the next lines, the -th line contains three integers separated by spaces.
Output Format
Output one line containing one integer, representing the maximum total value.
5
-5 5 -2
2 5 10
1 4 -2
4 -5 4
-2 2 7
19
6
0 0 6
1 0 -2
2 0 8
0 1 -2
1 1 5
2 1 -2
15
5
0 0 2
4 0 2
3 2 -1
1 2 2
1 1 -1
5
2
0 0 -1
1 0 -1
0
Hint
Sample Explanation 1.

Choose points .
Sample Explanation 2.
Note that points are collinear. Points are collinear.
Sample Explanation 3.
In this sample, no three points are collinear. One chosen parallel line passes through points , and the other passes through points .
Constraints
All input testdata satisfy the following conditions.
, , . .
| Subtask | Score | No three points are collinear | Let be a line in the plane passing through two distinct points, and let be another line in the plane passing through two distinct points. Then and are not parallel to each other | Other conditions | |
|---|---|---|---|---|---|
| √ | × | All points are on the -axis | |||
| √ | √ | None | |||
| × | |||||
| × | |||||
| × | |||||
Translated by ChatGPT 5