#P10698. [SNCPC2024] 最大流
[SNCPC2024] 最大流
Problem Description
Given a directed acyclic graph with vertices and edges, where the capacity of each edge is . For every vertex except vertex , let the maximum flow from vertex to vertex be . Compute .
In a graph where every edge has capacity , a flow from vertex to vertex is a path from vertex to vertex . If there can be at most edge-disjoint flows from vertex to vertex at the same time (that is, no edge belongs to two flows), then we say the maximum flow from vertex to vertex is .
Input Format
The first line contains three integers ($2 \leq n \leq 10^5, 1 \leq m \leq 2 \times 10^5, 1 \leq k \leq 50$), separated by spaces, representing the number of vertices, the number of edges, and the parameter.
The next lines each contain two integers (), separated by spaces, describing a directed edge.
The graph is guaranteed to have no self-loops, but it may contain multiple edges. It is guaranteed to be a directed acyclic graph.
Output Format
Output exactly one line containing integers, separated by spaces. For the -th integer, if the maximum flow from vertex to vertex does not exceed , output its value; otherwise output .
7 12 3
1 2
1 3
3 2
3 4
2 4
1 5
5 6
3 6
1 7
5 7
6 7
4 7
2 1 2 1 2 3
5 8 50
1 2
1 2
1 2
3 2
2 4
2 4
2 4
2 4
3 0 3 0
Hint
The graph in the first sample is shown below:

We can find edge-disjoint paths from vertex to vertex :
We cannot find any more edge-disjoint paths from vertex to vertex .
So the maximum flow from vertex to vertex is , but since , the sixth integer in the answer is .
Translated by ChatGPT 5