#584. 「Nowcoder多校 2019 Day4」meeting
「Nowcoder多校 2019 Day4」meeting
当前没有测试数据。
题目描述
A new city has just been built. There're nnn interesting places numbered by positive numbers from to . In order to save resources, only exactly roads are built to connect these nnn interesting places. Each road connects two places and it takes 1 second to travel between the endpoints of any road. There is one person in each of the places numbered and they've decided to meet at one place to have a meal. They wonder what's the minimal time needed for them to meet in such a place. (The time required is the maximum time for each person to get to that place.)
输入格式
First line two positive integers, - the number of places and persons. For each the following lines, there're two integers that stand for a road connecting place and . It's guaranteed that these roads connected all places. On the following line there're different positive integers separated by spaces. These are the numbers of places the persons are at.
输出格式
A non-negative integer - the minimal time for persons to meet together.
样例
样例输入
4 2
1 2
3 1
3 4
2 4
样例输出
2
数据范围与提示
备注:
说明 They can meet at place 1 or 3.