25 teams scored 2010 points on this task, for a maximum score of 100, an average score of 80.4 and a median score of 100.
Valerio is drawing his (rooted) Christmas tree to celebrate his favorite holiday. Being a computer scientist, his tree has N nodes, numbered from 0 to N-1, with node 0 being the root. Each other node is connected to its parent P_i by an edge of length W_i. Valerio now wants to color some of the edges to make his drawing look more similar to the original subject. He also wants to avoid making the drawing too chaotic, therefore each node i can have at most K_i incident colored edges. What is the maximum total length of colored edges he can achieve?