Data Structures & AlgorithmsVery hardCodeforces Div 2 D · ICPC regional
An undirected graph has the vertices C, D, K, M, Q, V and the edges Q–D, Q–M, C–D, K–D, K–V, D–M, D–V. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?
- A. 3
- B. 5
- C. 2
- D. 4
Correct answer: A. 3
Because the graph contains an odd cycle it is not bipartite, so the bipartite shortcut of König's theorem does not apply; the true maximum is 3. Taking edges greedily in the listed order yields only 2, a maximal but not maximum matching.
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
- Cities F, M, O, R, S are joined by roads with these travel costs: M–O 11, M–S 20, M–R 7, M–F 16, O–S 16, O–R 14, O–F 8, S–R 11, S–F 8, R–F…
- A tree has the vertices D, F, I, O, Q, R, S, U, X and the edges I–S, I–U, I–O, I–D, D–X, D–F, U–Q, X–R. What is the minimum number of…
- A tree on the vertices E, H, K, S, U, X has the arcs E→S, S→H, H→K, U→H, X→K (each undirected edge is directed as shown). You may reverse…
- A directed graph has the vertices E, G, L, N, U and the arcs N→L, N→E, N→G, L→N, L→E, U→N, U→L, U→E, U→G, E→L, E→U, E→G, G→U, G→E. Count…
- A connected undirected graph has the vertices A, I, J, N, O, X, Z and the edges A–X, A–O, X–O, X–I, O–Z, O–N, I–N, I–J. How many bridges…
- An undirected graph has the vertices D, G, L, Q, R, X, Y and the edges R–G, Y–R, L–X, Y–G, D–R, Y–L, D–G. How many simple cycles does it…