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

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

Автор dumbhead, 11 лет назад, По-английски

I was trying this problem HOLI but I am not able to come up with a good solution. I was thinking of pairing up the leaf nodes of the longest path in the tree. After pairing up, I remove the two paired nodes and continue with the next longest path. But this would give a O(n^2) approach resulting TLE. Can somebody tell me an efficient approach for the solving problem ? I would be happy if somebody helps me in this. Thank you in advance.

Полный текст и комментарии »

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

Автор dumbhead, 11 лет назад, По-английски

I was trying this problem SFLIP but I am not able to come up with a solution. Is the intended solution requires a segment tree approach ? I would be happy if somebody helps me in solving this problem ? Thank you in advance.

Полный текст и комментарии »

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