#P9902. 『PG2』模拟最大流
『PG2』模拟最大流
Problem Description
Given nodes and directed edges, each edge has a capacity. It is guaranteed that every edge satisfies . Find the maximum flow from node to node .
Input Format
The first line contains three positive integers , , and , separated by spaces.
The next lines each contain three positive integers , , and , separated by spaces, meaning that the -th directed edge starts from , ends at , and has capacity .
Output Format
Output one integer, the maximum flow from to .
9 21 3
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
1 3 1
2 4 1
3 5 1
4 6 1
5 7 1
6 8 1
7 9 1
1 4 1
2 5 1
3 6 1
4 7 1
5 8 1
6 9 1
3
5 10 2
3 5 73
3 4 33
3 5 84
4 5 10
3 4 15
1 2 83
1 3 8
1 3 24
5 5 15
1 2 62
32
Hint
For of the testdata, , , .
For of the testdata, , , .
For of the testdata, , , .
For of the testdata, , , .
For of the testdata, , , , .
Translated by ChatGPT 5