-->
当前位置:首页 > 题库

PROGRAMMING:Max stream plus

Luz5年前 (2021-05-10)题库417
This is a template question.
Given $$n $$points, $$M $$edges, given the capacity of each edge, find the maximum flow from point $$s $$to point $$t $.
###Input format:
The first line contains four integers $$n, m, s, T $$.
The next $$M $$line contains three integers $$u, V, C $$in each line, representing an edge from $$u $$to $$V $$with flow of $$C $.
The data is guaranteed to be $$1 / Leq n / Leq 1200, 1 / Leq M / Leq 120000, 1 / Leq C / Leq 2 ^ {31} - 1 $.
Ensure that the answer does not exceed $$2 ^ {31} - 1 $$.
The complexity of common network flow algorithms is $$o / left (n ^ 2m / right) $. Please optimize the algorithm as much as possible.
###Output format:
Output the maximum flow from point $$s $$to point $$t $$.
###Input sample 1:
```in
7 14 1 7
1 2 5
1 3 6
1 4 5
2 3 2
2 5 3
3 2 2
3 4 3
3 5 3
3 6 7
4 6 5
5 6 1
6 5 1
5 7 8
6 7 7
```
###Output sample 1:
```out
fourteen
```
###Input sample 2:
```in
10 16 1 2
1 3 2
1 4 2
5 2 2
6 2 2
3 5 1
3 6 1
4 5 1
4 6 1
1 7 2147483647
9 2 2147483647
7 8 2147483647
10 9 2147483647
8 5 2
8 6 2
3 10 2
4 10 2
6 7 7
```
###Output sample 2:
```out
eight
```






answer:If there is no answer, please comment