当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6638:Snowy Smile

题目描述
There are $n$ pirate chests buried in Byteland, labeled by $1,2,\dots,n$. The $i$-th chest's location is $(x_i,y_i)$, and its value is $w_i$, $w_i$ can be negative since the pirate can add some poisonous gases into the chest. When you open the $i$-th pirate chest, you will get $w_i$ value.

You want to make money from these pirate chests. You can select a rectangle, the sides of which are all paralleled to the axes, and then all the chests inside it or on its border will be opened. Note that you must open all the chests within that range regardless of their values are positive or negative. But you can choose a rectangle with nothing in it to get a zero sum.

Please write a program to find the best rectangle with maximum total value.
输入解释
The first line of the input contains an integer $T(1\leq T\leq 100)$, denoting the number of test cases.

In each test case, there is one integer $n(1\leq n\leq 2000)$ in the first line, denoting the number of pirate chests.

For the next $n$ lines, each line contains three integers $x_i,y_i,w_i(-10^9\leq x_i,y_i,w_i\leq 10^9)$, denoting each pirate chest.

It is guaranteed that $\sum n\leq 10000$.
输出解释
For each test case, print a single line containing an integer, denoting the maximum total value.
输入样例
2
4
1 1 50
2 1 50
1 2 50
2 2 -500
2
-1 1 5
-1 1 1
输出样例
100
6
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6638

最后修改于 2020-10-25T23:33:03+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/4000MS(Java/Others) 524288/524288K(Java/Others)