#P6113. Maximum Matching in an Undirected Graph

    ID: 19335 Type: Default 1000ms 256MiB

Maximum Matching in an Undirected Graph

Maximum Matching in an Undirected Graph

Given an undirected graph with \(n\) nodes and \(m\) edges, find its maximum matching. A matching in a graph is a set of edges such that no two edges share a common vertex. The goal is to maximize the number of matched pairs.

inputFormat

The first line contains two integers \(n\) and \(m\) representing the number of nodes and edges, respectively. Each of the following \(m\) lines contains two integers \(u\) and \(v\) (1-indexed) which indicate an undirected edge between nodes \(u\) and \(v\>.

outputFormat

Output a single integer that represents the size of the maximum matching.

sample

1 0
0

</p>