Fire Extinguisher Installation
Time limit1sMemory limit128 MB
Place extinguishers on tree rooms, each covering at most S rooms within distance K, so every room is covered; minimize the count.
Problem
Byteasar has built a new palace. It has rooms and corridors connecting them, and each corridor joins exactly two rooms. The rooms are numbered from to , and the only entrance to the palace is room . Because there is exactly one path from the entrance to every other room, the rooms form a tree.
The fire chief wants to place fire extinguishers throughout the palace under the following rules.
- An extinguisher is placed inside a room, and a room may hold any number of them.
- A single extinguisher can protect at most rooms chosen from those it can reach through at most corridors (the rooms whose distance from it is at most ). The set of rooms it actually protects is called that extinguisher's coverage area.
- Every room must belong to the coverage area of at least one extinguisher.
Having spent almost his entire budget on the palace, Byteasar wants to protect every room while using as few extinguishers as possible. Find the minimum number of extinguishers required.
Input
The first line contains three integers , , and separated by spaces (, , ).
Each of the next lines contains two integers and separated by a space, meaning there is a corridor connecting room and room .
Output
Print the minimum number of fire extinguishers required, on a single line.
Hint
