Problem C
Cat in a tree
A cat lives in a tree that has
Input
First line has two integers,
We always have
Output
Output should contain one integer: the maximum number of nodes that can be marked.
Sample Input 1 | Sample Output 1 |
---|---|
4 3 0 0 1 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
3 1000 0 0 |
1 |