UPGRADE
CodeChefOpen on judge ↗
Chef is given a tree ($0$ being its root). Each node has value called its Version Number. Upgrade on subtree is increasing version of least value nodes in the subtree to version value in that subtree greater than those minimum value nodes. Cost of upgrade is difference between least node value and node value just greater than it. There are $three$ types of queries, query 1, query 2 and query
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