Chef, Leonardo And Queries
Chef has a tree with N nodes numbered 1 through N. Initially, each node has value 0. Chef's best friend Leonardo loves queries on trees. He asked Chef to perform Q queries. Each query is of one of the following two types: - 1 v k a b: Consider f(0) = a, f(1) = b, f(i) = f(i - 1) + f(i - 2) for i ≥ 2. For each node u of the tree, let d be the distance (in edges) from v to u. Then, if d ≤ k, Chef
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