Polling Stations
InterviewTime limit1sMemory limit64 MB
Given an undirected graph, find the smallest set of vertices such that every edge touches at least one chosen vertex.
Problem
The Kingdom of Byteland decided to hold a vote. To take part, an inhabitant travels to the nearest town that has a polling station. Everyone is supposed to vote, but most people are very lazy and will not go if every polling station is more than one day of travel from their home town. Many people in the countryside live along the roads, so for every road at least one of the two towns it connects must have a polling station.
The king wants to choose as few towns as possible. Find the minimum number of towns that must have a polling station.
Input
The first line contains two integers and (, ), the number of towns in the kingdom and the number of roads. Towns are numbered from to .
Each of the next lines contains two integers and (, ), meaning that a road runs between towns and and takes one day to travel.
Output
Print the minimum number of towns that must have a polling station.