Fan Mail


Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 512M

Author:
Problem type

Max Flow is a very popular influencer in the competitive programming world and as such gets sent a large volume of fan mail. In particular, Max's number one fan sends a practically infinite number of letters all. the. time. As a very dedicated public figure, Max responds to each and every letter but the postal service has limits on how many letters can be transported at a given time.

Given the possible postage routes and their letter-capacities as a directed graph, the location of max and the location of max's number one fan, what is the largest volume of letters that can be sent from max to his fan through the postage system?

Input Specification

The first line will contain two integers \(V, E\), \(1 \leq V \leq 100\), \(1 \leq E \leq V^2\), the number of locations in the network (zero-indexed) and the number of postage routes

The next \(E\) lines will contain three integers, \(u, v, cap\), \(0 \leq u,v \leq V\), \(1 \leq cap \leq 100\), the start and end location of a postal route and it's capacity.

The final line will contain two integers \(m, f\), \(0 \leq m,f \leq V | m \neq f\), the location of max and his fan respectively.

Output Specification

A single integer, the maximum number of letters that can be sent from Max to his *number

Sample Input 1

4 5
0 1 44
0 2 30
0 3 9
1 2 57
1 3 20
0 3

Sample Output 1

29

Sample Input 2

5 8
0 1 44
0 2 30
0 3 9
0 4 57
1 2 20
1 4 44
2 3 9
3 4 67
0 4

Sample Output 2

119

Comments

There are no comments at the moment.