Graph Maximum Matching
InterviewTime limit2sMemory limit512 MB
Given a small graph, decide whether some edges can be kept so every vertex has degree exactly 1.
- Level
Easy2 of 10
- Topics
- Graph, Backtracking, Greedy
- Solved
- No attempts yet
Problem
An undirected graph has vertices and edges.
Write a program that decides whether you can delete some of the edges so that every vertex has degree exactly .
Input
The first line contains and . (, )
Each of the next lines describes one edge and contains the numbers of the two vertices it joins.
Two vertices can be joined by more than one edge. There are no loops. Vertex numbers run from to .
Output
Print if deleting some edges can make every vertex have degree , and otherwise.