2018-12-21から1日間の記事一覧

yukicoder 772 Dynamic Distance Sum

https://yukicoder.me/problems/no/772The centroid gives the answer. So we should compute centroid quickly and calculate the sum of distances between the centroid and the marked vertices.Looking at a edge, we obtain two trees by removing the…