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 (4), S→T (9), C→D (8), C→T (3), B→E (6), B→T (5), D→C (6), D→E (4), D→T (8), E→C (3), E→B (5). What is the maximum flow from S to T?
- A. 9
- B. 2
- C. 13
- D. 14
Correct answer: C. 13
Edmonds–Karp (augmenting paths with residual capacities) gives maximum flow 13, which equals the minimum cut capacity. Sending along a single best path only carries 9; the total out of S is 13; 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
- A tree has the vertices A, E, G, I, K, L, N, O, W and the edges G–W, W–O, O–E, E–L, G–I, G–A, A–K, O–N. A centroid is a vertex whose…
- A tree has vertices A, B, F, H, I, K, M, Q, S and weighted edges (weights in brackets): Q–S (5), Q–M (4), Q–K (1), S–H (3), Q–A (7), K–B…
- 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…
- 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): ..#..... .#.....# ...##... ....###. #.###…