CF1083E.The Fair Nut and Rectangles
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The Fair Nut got stacked in planar world. He should solve this task to get out.
You are given n rectangles with vertexes in (0,0) , (xi,0) , (xi,yi) , (0,yi) . For each rectangle, you are also given a number ai . Choose some of them that the area of union minus sum of ai of the chosen ones is maximum.
It is guaranteed that there are no nested rectangles.
Nut has no idea how to find the answer, so he asked for your help.
输入格式
The first line contains one integer n ( 1≤n≤106 ) — the number of rectangles.
Each of the next n lines contains three integers xi , yi and ai ( 1≤xi,yi≤109 , 0≤ai≤xi⋅yi ).
It is guaranteed that there are no nested rectangles.
输出格式
In a single line print the answer to the problem — the maximum value which you can achieve.
输入输出样例
输入#1
3 4 4 8 1 5 0 5 2 10
输出#1
9
输入#2
4 6 2 4 1 6 2 2 4 3 5 3 8
输出#2
10
说明/提示
In the first example, the right answer can be achieved by choosing the first and the second rectangles.
In the second example, the right answer can also be achieved by choosing the first and the second rectangles.