5906: BZOJ1906:树上的蚂蚁

Memory Limit:162 MB Time Limit:3 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description


输入格式


输出格式


样例输入

1
3
1 2 1
2 3 1
3
1 3 2
3 1 1
1 2 3

样例输出

2

提示

N< = 100000


题目来源

Play with tree By Amber

加入题单

算法标签: