Need help with tree problem

Правка en1, от I_love_Vovuh_s_cat, 2018-12-13 19:26:07

Given a tree with n nodes, rooted at 1. You have q offline queries with the form of ui, vi and xi. You have to add xi to every node in the simple path from ui to vi. It is guaranteed than ui is an ancestor of vi. Then you have to print out the values of all the nodes. The limit is... well, too large for O(n^2). Could anyone give me an approach to this problem?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский I_love_Vovuh_s_cat 2018-12-13 19:26:07 394 Initial revision (published)