QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 100

#583. Fire Extinguishers

الإحصائيات

Byteasar has had a new palace built. It consists of $n$ chambers and $n-1$ corridors connecting them. Each corridor connects exactly two chambers. The rooms are numbered from $1$ to $n$. There is only a single entrance to the palace, which leads to chamber no. 1. 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 different chambers.
  • For each room its assigned extinguisher is within the range of $k$ 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.

Input

The first line of the standard input contains three integers $n$, $s$ and $k$ separated by single spaces, $1 ≤ n ≤ 100\,000$, $1 ≤ s ≤ n$, $1 ≤ k ≤ 20$. Each of the following n-1 lines holds two integers separated by a single space. Line no. $i+1$ contains the numbers $1 ≤ x_i < y_i ≤ n$ denoting the corridor connecting chambers no. $x_i$ and $y_i$.

Output

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.

Example

Input

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

Output

4
problem_583_1.gif
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.