Oscars as a Tree
CodeChefOpen on judge ↗
All Oscar awards are numbered from 1 to N and arranged in a tree rooted at 1.Each nth Oscar has some integral value v. We can perform k queries on the given tree of following type. a)1 n u change the value of nth Oscar to u where u is an integer. b)2 n c print the product of the sub-tree of nth oscar and take it’s modulo with c. Input First line contains N (number of nodes) and k(number of q
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