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.
Input Format:
- The input starts with three integers:
- \(N\): The number of cities in Cloudland.
- \(M \): The number of roads connecting differenct cities in Cloudland
- \(K\): The remaining fuel units in Alice's car.
- \(C\) : Alice's current city
- 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\)
Output Format:
Output a single integer representing the total possible number of cities Alice can reach if she uses up all \(K\) units of her fuel.
Constraints:
\(2 \leq N \leq 10^3 \\ 0 \leq M \leq (N*(N-1))/2 \\ 1 \leq K \leq 10^6 \\ 1 \leq C \leq N\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial