MIT

아직 제출이 없습니다시간 제한5초메모리 제한952 MB

문제

This problem is dedicated to current ICPC champions. From one of 2020 ICPC Champions and, hopefully, 2023 ICPC Champions to 2021 and, hopefully, 2022 ICPC Champions with love.

You are given an edge-weighted tree TT on nn vertices. Define d_uvd\_{uv} to be the sum of weights on the only simple path between uu and vv in TT. Consider a full weighted graph GG, where the weight of the edge (u,v)(u, v) is d_uvd\_{uv}.

For every kk between 11 and n2\lfloor \frac{n}{2} \rfloor, calculate the maximum possible weight of a matching of size kk in graph GG. Recall that a matching of size kk is a set of kk edges such that no two edges in this set have a common vertex.

입력

The first line contains one integer nn (2n100,0002 \le n \le 100\\,000) --- the size of the tree.

The next n1n-1 lines describe the edges of the tree. The ii-th of them contains three integers u_iu\_i, v_iv\_i, w_iw\_i (1u_i,v_in1 \le u\_i, v\_i \le n, 1w_i1081 \le w\_i \le 10^8) meaning that there is an edge (u_i,v_i)(u\_i, v\_i) with weight w_iw\_i in TT.

It is guaranteed that the given edges form a tree.

출력

Print n2\lfloor \frac{n}{2} \rfloor integers --- maximum weights of matchings of the corresponding sizes in GG.