Data Structures & AlgorithmsVery hardCodeforces Div 2 D · ICPC regional
A flow network has source S and sink T, with directed arcs and capacities in brackets: S→E (8), S→T (3), B→E (6), B→T (7), E→T (9), C→E (2), C→T (3). What is the maximum flow from S to T?
- A. 8
- B. 11
- C. 12
- D. 2
Correct answer: B. 11
Edmonds–Karp (augmenting paths with residual capacities) gives maximum flow 11, which equals the minimum cut capacity. Sending along a single best path only carries 8; the total out of S is 11; and minimising the number of cut arcs (ignoring capacity) gives 2.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- Floyd–Warshall runs on vertices 1 to 4 with these arcs u→v (weight): 1→3 (1), 1→4 (4), 2→1 (1), 2→3 (3), 3→1 (12), 3→2 (11), 3→4 (3), 4→1…
- A directed acyclic graph has the vertices C, D, H, I, U, X and the arcs U→I, U→H, U→C, D→I, D→C, X→I, X→C, H→C. Two players alternately…
- A grid has 6 rows and 8 columns (rows listed top to bottom; '.' is an open cell, '#' a wall): ..#..... .#.....# ...##... ....###. #.###…
- Two unmarked jugs hold 5 litres and 9 litres. Allowed operations: fill a jug completely, empty a jug completely, or pour one jug into the…
- A directed graph with no directed cycles has arcs u→v (weight) : X→E (-1), X→A (-3), X→J (8), E→G (-1), A→G (7), A→J (0), G→J (-3)…
- A directed acyclic graph has the vertices F, N, R, S, T, U, V, X and the directed edges R→V, U→S, S→X, F→X, N→V, R→S, U→F, F→N, R→F, R→T…