[Help Needed] Minimize Subtree Sum With Leaf Reattachment

Правка en1, от _Jain_, 2025-07-04 20:30:35

You are given a tree with nodes, numbered from 1 to . Each node has an integer value .

You can perform at most operations. In one operation, you may pick a leaf node and reattach it to any ancestor of its current parent.

After all operations, define as the sum of values in the subtree rooted at node . Your goal is to minimize the total sum:

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский _Jain_ 2025-07-04 20:32:52 56
en1 Английский _Jain_ 2025-07-04 20:30:35 416 Initial revision (published)