eolymp
bolt
Try our new interface for solving problems
Problems

Cloudy Days

Cloudy Days

Alice is navigating the country of Cloudland on a cloudy day, making it challenging to see her way. She has a car with $k$ units of fuel remaining, where each unit of fuel allows her to travel a distance of $1$ unit. Given the country's layout, consisting of several interconnected cities, and her current location, your task is to determine and print the total possible number of cities she can visit reach if she exhausts all her fuel. \InputFile The first line contains four integers: \begin{itemize} \item $n$: the number of cities in Cloudland. \item $m$: the number of roads connecting differenct cities in Cloudland \item $k$: the remaining fuel units in Alice's car. \item $c$: Alice's current city \end{itemize} The following $m$ lines describe the road connections between cities as pairs of integers $u, v$, indicating a bidirectional road between cities $u$ and $v$. \OutputFile Output a single integer representing the total possible number of cities Alice can reach if she uses up all $k$ units of her fuel.
Time limit 1 second
Memory limit 128 MiB
Input example #1
6 5 2 1
2 5
1 5
3 4
2 4
5 3
Output example #1
4