[Help Needed] Minimize Subtree Sum With Leaf Reattachment

Revision en2, by _Jain_, 2025-07-04 20:32:52

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

You can perform at most k operations. In one operation, you may pick a leaf node and reattach it to any node.

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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English _Jain_ 2025-07-04 20:32:52 56
en1 English _Jain_ 2025-07-04 20:30:35 416 Initial revision (published)