Deeply Rooted Tree in Vitaly Garden
CodeChefOpen on judge ↗
An old Gardner came to Little Vitaly's Garden and gave her a rooted tree T and an integer d. Each node of the rooted tree has a weight Ai. Each Ai belongs to a set of positive integers. Assume the tree is rooted an node indexed 1. The old Gardner defines a path as a sequence of nodes 0, v1, v2, ..., vk > where k ≥ 0. The weight of a path is the sum of node weights for all nodes in the path. Ol
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