Data Structures & AlgorithmsHardCodeforces Div 2 D · ICPC regional
An undirected graph has the vertices C, E, H, K, M, N, T, Y and the edges E–M, E–N, E–Y, E–T, C–N, C–H, C–Y, C–T, M–N, M–K, N–K, Y–T. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?
- A. 6
- B. 4
- C. 5
- D. 3
Correct answer: B. 4
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 4. Taking edges greedily in the listed order yields only 3, 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
- An undirected graph has the vertices C, F, J, O, U, V, W, X, Z and the edges Z–O, Z–U, Z–C, F–U, F–J, O–J, O–V, O–W, U–W, U–X, U–C, V–W…
- Grid with 4 rows and 4 columns (top to bottom). A cell marked G is a gate; '.' is a normal cell: .G.G G... G... G... Each step, which is a…
- An undirected connected graph on 6 vertices has the edges (weights in brackets, all distinct): U–A (27), Y–M (6), I–Y (29), U–M (21), A–M…
- A pile holds p stones. In one move a player removes exactly s stones, where s is one of {2, 5} and s ≤ the pile size. The player who…
- An undirected graph has the vertices B, O, P, Q, T, V, Z and the edges Q–Z, Q–V, Q–T, P–Z, P–B, P–T, Z–O, Z–V, O–B. What is the size of a…
- A tree on the vertices C, F, I, R, V, X has the arcs C→R, V→C, I→V, V→X, F→V (each undirected edge is directed as shown). You may reverse…