#P4153. [WC2015] k 小割

    ID: 3080 远端评测题 2000ms 128MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>搜索2015WC/CTSC/集训队O2优化优先队列最小割

[WC2015] k 小割

Description

Given a directed weighted network G=(V,E)G = (V, E), a weight function w:EZw: E \rightarrow \mathbb{Z^{*}} (i.e., for any edge ee, the weight w(e)w(e) is a positive integer), and vertices s,tVs, t \in V. Consider any edge set SES \subseteq E, and let G=(V,ES)G' = (V, E - S). If there is no path from ss to tt in GG', then SS is valid.

Let S\mathfrak{S} be the set of all such edge sets SS. Output the sums of edge weights of the smallest kk sets in S\mathfrak{S} by nondecreasing w(S)w(S), where w(S)=eSw(e)w(S) = \sum_{e \in S} w(e).

Input Format

The first line contains 55 positive integers n,m,s,t,kn, m, s, t, k, where s,t,ks, t, k are as above, and n,mn, m denote V,E\lvert V \rvert, \lvert E \rvert (the numbers of vertices and edges). Vertices are labeled from 11 to nn. It is guaranteed that sts \neq t.

The next mm lines each contain 33 integers x,y,zx, y, z, representing a directed edge from xx to yy with weight zz. Multiple edges may exist, but there are no self-loops.

Output Format

If S<k\lvert \mathfrak{S} \rvert < k, first output S\lvert \mathfrak{S} \rvert lines, each containing one integer, which are the first S\lvert \mathfrak{S} \rvert values of w(S)w(S). Then output one more line with a single integer 1-1.

If Sk\lvert \mathfrak{S} \rvert \geq k, output kk lines, which are the first kk values of w(S)w(S).

In both cases, the outputs must be in nondecreasing order of w(S)w(S).

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 nn \le mm kk \le Constraints
121 \sim 2 1010 20\le 20 106{10}^6 Edge weights do not exceed 6553665536.
363 \sim 6 5050 100\le 100 100100
7107 \sim 10 30003000 =2n4= 2 n - 4 5×1055 \times {10}^5 ss has edges to all vertices other than tt; every vertex other than ss has an edge to tt; edge weights do not exceed 23112^{31} - 1.
111411 \sim 14 1.5×1051.5 \times {10}^5
152015 \sim 20 5050 1500\le 1500 100100 Edge weights do not exceed 6553665536.

Translated by ChatGPT 5