Virus Attack
CodeChefOpen on judge ↗
Flippy the Bird and Fluffy the squirrel lives on a big, big tree. The tree can be represented as a rooted tree of n nodes, whose root is node 1. There are ci little animals living on node i of the tree. There is a virus attack on Flippy and Fluffy's tree! This virus is lethal and also spreads very fast. The virus can spread from a node to all its children. (note that a node cannot spread the virus
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