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

建议使用的浏览器:

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

6447:YJJ's Salesman

题目描述
YJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination.
One day, he is going to travel from city A to southeastern city B. Let us assume that A is $(0, 0)$ on the rectangle map and B $(10^9, 10^9)$. YJJ is so busy so he never turn back or go twice the same way, he will only move to east, south or southeast, which means, if YJJ is at $(x, y)$ now $(0\le x\le 10^9,0\le y\le 10^9)$, he will only forward to $(x+1,y)$, $(x,y+1)$ or $(x+1,y+1)$.
On the rectangle map from $(0,0)$ to $(10^9,10^9)$, there are several villages scattering on the map. Villagers will do business deals with salesmen from northwestern, but not northern or western. In mathematical language, this means when there is a village $k$ on $(x_k, y_k)$ $(1\le x_k\le10^9, 1\le y_k\le10^9)$, only the one who was from $(x_k-1,y_k-1)$ to $(x_k,y_k)$ will be able to earn $v_k$ dollars.(YJJ may get different number of dollars from different village.)
YJJ has no time to plan the path, can you help him to find maximum of dollars YJJ can get.
输入解释
The first line of the input contains an integer $T$ $(1≤T≤10)$,which is the number of test cases.

In each case, the first line of the input contains an integer $N$ $(1≤N≤10^5)$.The following $N$ lines, the $k$-th line contains 3 integers, $x_k, y_k, v_k$ $(0≤v_k≤10^3)$, which indicate that there is a village on $(x_k,y_k)$ and he can get $v_k$ dollars in that village.
The positions of each village is distinct.
输出解释
The maximum of dollars YJJ can get.
输入样例
1
3
1 1 1
1 2 2
3 3 1
输出样例
3
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6447

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

共提交 0

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