#P4153. [WC2015] k 小割
[WC2015] k 小割
Description
Given a directed weighted network , a weight function (i.e., for any edge , the weight is a positive integer), and vertices . Consider any edge set , and let . If there is no path from to in , then is valid.
Let be the set of all such edge sets . Output the sums of edge weights of the smallest sets in by nondecreasing , where .
Input Format
The first line contains positive integers , where are as above, and denote (the numbers of vertices and edges). Vertices are labeled from to . It is guaranteed that .
The next lines each contain integers , representing a directed edge from to with weight . Multiple edges may exist, but there are no self-loops.
Output Format
If , first output lines, each containing one integer, which are the first values of . Then output one more line with a single integer .
If , output lines, which are the first values of .
In both cases, the outputs must be in nondecreasing order of .
3 3 1 3 100
1 2 3
2 3 4
1 3 5
8
9
12
-1
5 8 1 5 10
1 2 45176
1 3 41088
1 4 32001
2 5 48931
3 5 39291
4 5 28970
2 3 48131
4 2 49795
116468
117192
118265
120223
145438
147235
149193
157556
158280
161311
Hint
| Test Point ID | Constraints | |||
|---|---|---|---|---|
| Edge weights do not exceed . | ||||
| has edges to all vertices other than ; every vertex other than has an edge to ; edge weights do not exceed . | ||||
| Edge weights do not exceed . |
Translated by ChatGPT 5
京公网安备 11011102002149号