#P2604. [ZJOI2010] 网络扩容

    ID: 1617 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2010各省省选网络流浙江图的建立,建图最大流费用流

[ZJOI2010] 网络扩容

Description

Given a directed graph, each edge has a capacity cc and an expansion cost ww. The expansion cost is the cost required to increase the capacity by 11. Find:

  1. The maximum flow from 11 to nn without any expansion.
  2. The minimum total expansion cost required to increase the maximum flow from 11 to nn by kk.

Input Format

The first line contains three integers n,m,kn, m, k, denoting the number of vertices, the number of edges, and the required increase in flow.

The next mm lines each contain four integers u,v,c,wu, v, c, w, describing a directed edge from uu to vv with capacity cc and expansion cost ww.

Output Format

Output one line containing two integers, which are the answers to problems 11 and 22 respectively.

5 8 2
1 2 5 8
2 5 9 9
5 1 6 2
5 1 1 8
1 2 8 7
2 5 4 9
1 2 1 1
1 4 2 1
13 19

Hint

  • Constraints
    • For 30%30\% of the testdata, it is guaranteed that n100n \le 100.
    • For 100%100\% of the testdata, it is guaranteed that 1n1031 \le n \le 10^3, 1m5×1031 \le m \le 5 \times 10^3, 1k101 \le k \le 10, 1u,vn1 \le u, v \le n, and 1c,w1001 \le c, w \le 100.

Translated by ChatGPT 5