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)?

  1. A. 6
  2. B. 4
  3. C. 5
  4. 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.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic