#P4153. [WC2015] k 小割

    ID: 4863 远端评测题 2000ms 128MiB 尝试: 0 已通过: 0 显示难度NOI/NOI+/CTS 上传者: 标签>搜索2015O2优化优先队列最小割WC

[WC2015] k 小割

Problem Description

Given a directed weighted network G=(V,E)G = (V, E), a weight function w:E→Z∗w: E \rightarrow \mathbb{Z^{*}} (i.e., for any edge ee, the weight w(e)w(e) is a positive integer), and vertices s,t∈Vs, t \in V. Consider any edge set S⊆ES \subseteq E, and let G′=(V,E−S)G' = (V, E - S). If there is no path from ss to tt in G′G', 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)=∑e∈Sw(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 s≠ts \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 ∣S∣≥k\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 n≤n \le mm k≤k \le Constraints
1∼21 \sim 2 1010 ≤20\le 20 106{10}^6 Edge weights do not exceed 6553665536.
3∼63 \sim 6 5050 ≤100\le 100 100100
7∼107 \sim 10 30003000 =2n−4= 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 231−12^{31} - 1.
11∼1411 \sim 14 1.5×1051.5 \times {10}^5
15∼2015 \sim 20 5050 ≤1500\le 1500 100100 Edge weights do not exceed 6553665536.

Translated by ChatGPT 5