|
||||||||||
Paths on the treeTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2853 Accepted Submission(s): 888 Problem Description bobo has a tree, whose vertices are conveniently labeled by 1,2,¡,n. There are m paths on the tree. bobo would like to pick some paths while any two paths do not share common vertices. Find the maximum number of paths bobo can pick. Input The input consists of several tests. For each tests: The first line contains n,m (1¡Ün,m¡Ü105). Each of the following (n - 1) lines contain 2 integers ai,bi denoting an edge between vertices ai and bi (1¡Üai,bi¡Ün). Each of the following m lines contain 2 integers ui,vi denoting a path between vertices ui and vi (1¡Üui,vi¡Ün). Output For each tests: A single integer, the maximum number of paths. Sample Input
Sample Output
Author Xiaoxu Guo (ftiasch) Source | ||||||||||
|