Given a tree with N nodes we are required to seperate a connected component with exactly k nodes.↵
You are given queries specifying this k. We need to find the minimum edges to be removed for each query.<br>↵
First line specifies N.<br>↵
Next N-1 lines specify edges.<br>↵
Next line shows Q(number of queries).<br>↵
Subsequent Q lines contain k for each query.<br>↵
↵
Constraint:<br> N <= 3000<br>↵
Q <= 3000<br>↵
K <= N<br>↵
↵
Example: <br>↵
Input: <br>5<br>↵
1 2<br>↵
1 3<br>↵
1 4<br>↵
1 5<br>↵
3<br>↵
1<br>↵
2<br>↵
4<br>↵
<br>↵
Output: <br>1<br>↵
3<br>↵
1<br>↵
↵
↵
↵
You are given queries specifying this k. We need to find the minimum edges to be removed for each query.<br>↵
First line specifies N.<br>↵
Next N-1 lines specify edges.<br>↵
Next line shows Q(number of queries).<br>↵
Subsequent Q lines contain k for each query.<br>↵
↵
Constraint:<br> N <= 3000<br>↵
Q <= 3000<br>↵
K <= N<br>↵
↵
Example: <br>↵
Input: <br>5<br>↵
1 2<br>↵
1 3<br>↵
1 4<br>↵
1 5<br>↵
3<br>↵
1<br>↵
2<br>↵
4<br>↵
<br>↵
Output: <br>1<br>↵
3<br>↵
1<br>↵
↵
↵
↵