Wayne

查看题解 查看答案
题目描述
Time Limit: 1000 ms
Memory Limit: 256 mb

An evil wizard stared at Wayne's father and cleverly dodged his father's bodyguard. First, he tortured Wayne's family.
 Wayne hid. Wayne listened to the screams of his family, and his fear could not subside for a long time. Wayne left home
 as soon as the wicked old witch had gone. When Wayne ran, she even heard the screams of the family. Since that day, 
Wayne has believed that light can't save the world, because in demasiari, the light magician will never lack, just like the most 
powerful and beautiful laches can't save the world in this world. From that day on, Wayne felt like a dark hunter. Wayne 
survived on the money left by her father. Soon, a guide was willing to take her as an apprentice and teach Wayne martial 
arts and the use of crossbow. Of course, we should test her ability before we teach her again. For a certain tree, you can
 add a real weight x (floating-point type) to the edge of the simple path between any two leaves. Now let her judge whether
 the edge weight of each edge can be any value through such operation.However, Wayne can't do this. Now, please help
 her judge if the tree can do it ,output"YE5", else output"NO"; 

输入输出格式
输入描述:
The first line gives you a number T representing a group of T (T < = 50), the second line has a n n (n < = 1e5) representing n points, the third line outputs the weight of each point, and the next n-1 represents an edge with w (W < = 1e9) between point a (a < = n) and point B (b < = n).
输出描述:
if the tree can do it ,output"YE5", else output"NO";
输入输出样例
输入样例#:
1
6
1 2 3 4 5 6
1 2 1
1 3 1
1 4 1 
2 5 1
2 6 1
输出样例#:
复制
YE5
编辑器外观×
主题
字号 16px
背景
登录后免费刷此题

提交代码后在此处可查看状态