Query of Color
CodeChefOpen on judge ↗
In order to decide who gets to keep the Going Merry,the full-sized ship owned by the Straw Hat Pirates, Usopp has decided to challenge Luffy with a problem: Luffy is given a rooted tree with **n** vertices. Vertex number **1** is the root of this tree. Each vertex can be either **black** or **white**. At first, all vertices are **white**. He is asked to process **q** queries. Each **node has som
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