Happy Sequence
CodeChefOpen on judge ↗
Amy and Penny are very good Friends. They are also very competitive with each other in solving the problems of competitive programming. One day Amy challenges Penny to solve this problem. Given is an **undirected tree of** $N$ **nodes, rooted at node** $1$. Each node $i$ has some **capacity** $A[i]$ associated with it. Penny has to answer $Q$ queries. In each query, Penny is __given an integer
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