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

建议使用的浏览器:

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

5361:In Touch

题目描述
There are n soda living in a straight line. soda are numbered by $1, 2, \dots, n$ from left to right. The distance between two adjacent soda is 1 meter. Every soda has a teleporter. The teleporter of $i$-th soda can teleport to the soda whose distance between $i$-th soda is no less than $l_i$ and no larger than $r_i$. The cost to use $i$-th soda's teleporter is $c_i$.

The $1$-st soda is their leader and he wants to know the minimum cost needed to reach $i$-th soda $(1 \le i \le n)$.
输入解释
There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case:

The first line contains an integer $n$ $(1 \le n \le 2 \times 10^5)$, the number of soda.
The second line contains $n$ integers $l_1,l_2,\dots,l_n$. The third line contains $n$ integers $r_1,r_2,\dots,r_n$. The fourth line contains $n$ integers $c_1,c_2,\dots,c_n$. $(0 \le l_i \le r_i \le n, 1 \le c_i \le 10^9)$
输出解释
For each case, output $n$ integers where $i$-th integer denotes the minimum cost needed to reach $i$-th soda. If $1$-st soda cannot reach $i$-the soda, you should just output -1.
输入样例
1
5
2 0 0 0 1
3 1 1 0 5
1 1 1 1 1
输出样例
0 2 1 1 -1
提示
If you need a larger stack size, 
please use #pragma comment(linker, "/STACK:102400000,102400000") and submit your solution using C++.
来自杭电HDUOJ的附加信息
Author zimpha@zju
Recommend wange2014

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

源链接: HDU-5361

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

共提交 0

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