LOL QUERIES ON A TREE
CodeChefOpen on judge ↗
During Codechef’s December Long Challenge, Abdullah tried solving the problem “CHEFFIB” using centroid decomposition and fenwick tree but his approach was too slow. Frustrated by it, he came up with an easier (maybe?) version of the problem. Given a rooted tree T (root = node 1) with N vertices (all containing value 0), Perform Q queries of the following type and output the final tree (nodes 1 to
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