← All problemsSign in

Rooted Trees

You are given a rooted tree having nodes N . Every node have value equal to zero initially , Let's call it version 1. You will be given Q queries of two type:- $1$ $ver1$ $ver2$ $v$ $c$ You have to make version $ver2$ from version $ver1$ by adding value $c$ in subtree of vertex $v$ at alternate levels , starting from level of vertex $v$. $2$ $ver1$ $v$ You have to tell value of vertex $v$ in

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start