Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя surajkvm007

Автор surajkvm007, история, 9 лет назад, По-английски

Given a forest with n vertices, add edges to make it into a tree with minimal diameter. I tried many approaches but none of them passed system test cases.Please suggest some algorithm to solve this problem.

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The idea is to play with tree diameters while merging trees, you can use the ideas in the editorial for this problem (is very similar): http://codeforces.net/contest/455/problem/C

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can you link the problem?

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

check the IOI 2013 Dreaming solution, it is almost the same problem.