#P3479. [POI 2009] GAS-Fire Extinguishers

[POI 2009] GAS-Fire Extinguishers

题目描述

Byteasar has had a new palace built. It consists of nn chambers and n1n-1 corridors connecting them. Each corridor connects exactly two chambers. The rooms are numbered from 11 to nn. There is only a single entrance to the palace, which leads to chamber no. 11). For each chamber there is exactly one route leading to it from the entrance, without turning back on the way. In other words, the chambers and the corridors form a tree - a connected acyclic graph.

The fire marshal who is to approve the building demands placing fire extinguishers inside.

The following are his exact requirements:

  • The fire extinguishers should be placed in (some) chambers, and one chamber may store any number of extinguishers.
  • Each chamber has to be assigned one fire extinguisher, though it may be stored in another chamber.
  • Each fire extinguisher can be assigned to at most SS different chambers.
  • For each room its assigned extinguisher is within the range of KK corridors.

Byteasar has a week spot for lavish palaces, so it is no surprise he has very little money now, right after completion of another splendid palace.

Therefore he is interested in the minimum number of fire extinguishers sufficient for satisfying fire marshal's demands.

输入格式

The first line of the standard input contains three integers nn, ss and kk separated by single spaces, 1n1051\le n\le 10^5, 1sn1\le s\le n, 1k201\le k\le 20.

Each of the following n1n-1 lines holds two integers separated by a single space.

Line no. i+1i+1 contains the numbers xi,yix_i,y_i denoting the corridor connecting chambers no.xix_i and yiy_i.

输出格式

The first and only line of the standard output is to hold one integer - the minimum number of fire extinguishers that have to be installed in palace.

12 3 1
1 12
3 8
7 8
8 9
2 12
10 12
9 12
4 8
5 8
8 11
6 8

4

提示

1n,m100000,1k20,xi11\leq n,m\leq 100000, 1\leq k \leq 20 , x_i\geq 1