Inquiry II
Time limit5sMemory limit512 MB
Given a connected simple graph with at most n+15 edges, output the size of its maximum independent set.
- Level
Hard8 of 10
- Topics
- Tree, DFS, Dynamic programming, Greedy
- Solved
- No attempts yet
Problem
For an undirected, simple graph , a subset is an independent set if no two elements of are connected by an edge. An independent set of is a maximum independent set if no independent set in has strictly more vertices. Given a specific kind of connected graph , find the size of a maximum independent set of .
Input
- The first line contains integers (), the number of vertices in the graph, and (), the number of edges in the graph.
- Then lines follow, each containing integers () indicating that there is an edge between vertices and .
The graph given by this input is simple and connected: there is at most one edge between each pair of vertices, there are no loops, and there is a path between each pair of vertices.
Output
- Output the number of vertices in a maximum independent set of the input graph.