You are not logged in. Please login at www.codechef.com to post your questions!

×

Query relating to TREEDGE

Do we have to go from u to v through their sub-trees or can we go from a parent node?

asked 30 Jan, 22:35

karan26122001's gravatar image

1★karan26122001
11
accept rate: 0%


You can go any way. Your aim is to maximise the weighted path length. So choose whichever is greater.

If you consider going through their subtrees, you'll have to add an edge to the end to one of the nodes in their subtree. You can choose this suitable node using dynamic programming.

Here is its editorial.

link

answered 31 Jan, 08:16

akashbhalotia's gravatar image

5★akashbhalotia
865214
accept rate: 10%

edited 27 Feb, 10:12

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,917
×1

question asked: 30 Jan, 22:35

question was seen: 104 times

last updated: 27 Feb, 10:12