Chef and Minimum Cost of His Tree
You are a given a tree of $N$ vertices. The $i$-th vertex has two things assigned to it — a value $A_i$ and a range $[L_i, R_i]$. It is guaranteed that $L_i \leq A_i \leq R_i$. You perform the following operation **exactly once**: - Pick a (possibly empty) subset $S$ of vertices of the tree. $S$ must satisfy the additional condition that no two vertices in $S$ are directly connected by an edge, i
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start