One Path

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

문제

You are given a tree TT consisting of NN vertices. Each edge has a positive integer weight.

You can perform the following operation on the given tree.

  • Delete an edge from the graph, then add a new edge between any two distinct vertices. The weight of the new edge must be the same as the weight of the deleted edge. The resulting graph need not be a tree.

We define the weight of a path as the sum of the weights of the edges on the path. The distance between two vertices uu and vv is defined as the weight of the shortest path from uu to vv — having the minimum weight. If there is no such path, we define the distance as 00.

The weight of a graph is the maximum of the distances between any two vertices.

Your task is to find the largest weight of the graph that can be obtained by performing the operation exactly ii times, for i=0,1,,Ki=0,1,\dots ,K.

입력

The first line contains two space-separated integers, NN and KK.

The ii-th of the following N1N-1 lines contains three space-separated integers u_iu\_i, v_iv\_i, and w_iw\_i — representing an undirected edge that connects two different vertices u_iu\_i and v_iv\_i with a weight of w_iw\_i.

It is guaranteed that the edges form a tree.

출력

Output K+1K+1 space-separated integers. The ii-th integer should be equal to the largest weight of the graph that can be obtained by performing the operation exactly i1i-1 times.

제한

  • 2N2,0002\le N\le 2\\, 000
  • 0K2,0000\le K\le 2\\, 000
  • 1u_i\<v_iN1\le u\_i\<v\_i\le N (1iN1)(1\le i\le N-1)
  • 1w_i1091\le w\_i\le 10^9 (1iN1)(1\le i\le N-1)