Problem Description Bi Luo is a magic boy, he also have a migic tree, the tree has N nodes, and each node, there is a Tre Asure, it's value is v[i], and for each edge, there are a cost c[i], which means every time you pass the edge I, you NE Ed to pay C[i].
You could attention that every v[i] can is taken only once, but for some c[i], and you could cost severial times.
Now, Bi Luo define Ans[i] as the most value can bi Luo gets if bi Luo starts at node I.
Bi Luo is also a excited boy, now he wants to know every ans[i], can I help him?
Input first line was a positive integer t (t≤104), represents there is t test cases.
Four each test:
The first line contain an integer N (n≤105).
The next line contains N integers v[i], which means the treasure ' s value of node I (1≤v[i]≤104).
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.