Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

need help with a problem about tree

Правка en2, от UltramanDecker, 2024-10-02 14:49:14

Given a tree with N nodes rooted at 1, each node has val a[i]

There are three types of queries:

1 x k v for all node y which distance to x is exactly k, add v to a[y], then output the maximum value of these a[y]

2 x k v for all node y which distance to x not exceed k, add v to a[y], then output the maximum value of these a[y]

3 x v for all node in subtree x, add v to a[y], then output the maximum value of these a[y]

It is guarantee that k is less than 10

Please help me with this problem. Thank you so much!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский UltramanDecker 2024-10-02 14:49:14 6
en1 Английский UltramanDecker 2024-10-02 14:48:47 560 Initial revision (published)