ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Задачи на графах > задача:


51080 - Deepest Point

Гость
• Вопросы к жюри (2)

Задачи раздела

• 50695 - Longest link between neurons
• 50414 - Traffic
• 50698 - Ayran Delivery
• 50978 - Albanian Coders
• 50699 - Fighting Vampires
• 50857 - Nine-Stones Game
• 50929 - Present from your uncles
• 51076 - Key person
• 51080 - Deepest Point
• 51079 - Key person - 2
• 50464 - From Tirana to Durres
• 50691 - Задача коммивояжёра
• 50701 - Cell Removal
• 50703 - Rruga me e shkurter
• 50704 - Te lidhura?
• 50705 - Klubet e studenteve

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Deepest Point

Question: You are given a source vertex and an edge list for a graph. Write a program that finds the height of the deepest point in the tree starting from the given source vertex.

Input specification: In the first line, you are given number of vertices (n), the number of edges (e) and the start vertex (src). In the following n lines you will have pairs of numbers (a,b) which represents an edge between the vertices a and b and 1 ≤ (a, b) ≤ n ≤ 250 and 0 ≤ e ≤ 5,000. Note: Assume that height of the root is 0.

Output specification: Show one integer: the depth of the deepest leaf.

Sample Input Sample Output
14 14 1
11 13
1 12
1 2
1 11
12 5
4 3
4 12
2 7
7 6
7 8
8 14
13 10
1 14
13 9
4



Для отправки решений необходимо выполнить вход.

www.contester.ru