Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Osman Ay.
Longest link between neurons
Ms. Xhani works in a hospital as neurologist.
A neuron is an electrically excitable living cell that
processes or transmits information through electrical
and chemical signals. These signals between neurons occur via
synapses, specialized connections with other cells. For her
research, she is trying to identify the points over the brain and
the connections between them. She has identified around 2500 points
on the brain and around 6000 neurons linking them. She works
on how these neurons communicate. One neuron can have many inputs
from many different synapses and these links are not two directional.
She needs to identify the longest connection between the given points.
Question: Write a program that is going
to find out the longest link starting from a given point.
Input specification
At the beginning, you will be given 3 integers;
- Number of points (V): an integer between 1 and 2500
- Number of neurons (linke) (E): an integer between 1 and 6000
- Starting point: an integer between 1 and 2500
Then in the following E lines you will be given two integers
where there is a link between from the first point to the second.
Output specification
Show one integer: The length of the longest link.
Sample Input I
8 6 4
1 5
7 6
4 1
2 7
4 2
4 3
|
Sample Output I
3
|
Для отправки решений необходимо выполнить вход.
|