Chef and Tree
Chef likes trees a lot. Now he thinking about one interesting problem on trees. He finds the following problem interesting, and you? Given a tree T and Q queries to it. Tree T has N nodes numbered from 1 to N. Each node v has a value Av associated with it. Queries can be one of three types. - 1 u v - reverse the values on the path between vertices u and v. - 2 ul ur vl vr - print "Yes" if al
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