ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1709. Пингвин-Авиа

Hint
Послано Frankey 26 июл 2009 21:25
This is very easy problem. You can use:
1) BFS or DFS to find the components of the graph;
2) Prim or Kruskal algo for minimum spanning tree.
Re: Hint
Послано SkorKNURE 26 окт 2010 16:28
spanning tree can be built during BFS. It's correct because graph is unweighted.
Re: Hint
Послано Artem Khizha [DNU] 16 июл 2011 17:22
Well, I see, that this is MST problem, but cannot get how to build a graph for it. Please, explain your step 1 more precisely.
Re: Hint
Послано Sehriyar Novruzov 28 июл 2015 17:56
Sure, it can be solved applying BFS or DFS + Minimum Spanning Tree algorithms (Prim Algorithm). But, BFS or DFS is enough to solve it. BFS or DFS is implemented to identify Connected Component and Non-Connected Component. No need to apply MST to remove redundant edges in each Connected Component. Because, while BFS or DFS you can built identify which edges you need and don't need. Here is one part of my code to do BFS and work like Prim algo

[code deleted]

Edited by moderator 19.10.2019 20:33