8949: Subdivision

内存限制:128 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:29 通过:23

题目描述

You are given a graph with n vertices and m undirected edges of length 1. You can do the following operation on the graph for arbitrary times:
Choose an edge (u,v) and replace it by two edges, (u,w) and (w,v), where w is a newly inserted vertex. Both of the two edges are of length 1.
You need to find out the maximum number of vertices whose minimum distance to vertex 1 is no more than k.

输入格式

The first line contains three integers n (1≤n≤10^5), m (0≤m≤2⋅10^5) and k (0≤k≤10^9).
Each of the next m lines contains two integers u and v (1≤u,v≤n), indicating an edge between u and v. It is guaranteed that there are no self-loops or multiple edges.

输出格式

Output an integer indicating the maximum number of vertices whose minimum distance to vertex 1 is no more than k.

输入样例 复制

5 4 2
1 2
2 3
3 1
4 5

输出样例 复制

5

数据范围与提示

Here is the illustration for the second example.


分类标签