Flow Problem
Time Limit: 5000/5000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 13561 Accepted Submission(s): 6482
Problem Description
Network flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow forthe weighted directed graph.
Input
The firstlineof input containsaninteger T, denoting thenumberof test cases.
For each test case, thefirstlinecontainstwo integers N and M, denoting thenumberof vertexes and edges inthe graph. (2 <= N <= 15, 0 <= M <= 1000)
Next M lines, eachlinecontainsthree integers X, Y and C, there is an edge from X to Y andthe capacity ofit is C. (1 <= X, Y <= N, 1 <= C <= 1000)
Output
For each test cases, you should output the maximum flow from source 1to sink N.
Sample Input
23212123133121231131
Sample Output
Case 1: 1
Case 2: 2