You are given a weighted undirected tree on nnn vertices and a list of qqq updates. Each update changes the weight of one edge. The task is to output the diameter of the tree after each update.
You are given a weighted undirected tree on nnn vertices and a list of qqq updates. Each update changes the weight of one edge. The task is to output the diameter of the tree after each update. (The distance between two vertices is the sum of the weights on the unique simple path that connects them. The diameter is the largest of all those distances.)
![HBC236183牛客搜索题Dynamic Diameter [CEOI 2019 day 1]题解
-第1张图片-东莞河马信息技术 HBC236183牛客搜索题Dynamic Diameter [CEOI 2019 day 1]题解
-第1张图片-东莞河马信息技术](https://www.xxstcz.com/zb_users/upload/2023/11/20231123211202170074512292952.jpeg)
(图片来源网络,侵删)