BAPC19-038.Inquiry II
Medium · 1 s · 256 MB
- icpc
- bapc
- 2019
For an undirected, simple graph we call a subset an independent set if no two elements of are connected by an edge. An independent set of is called a maximum independent set if there is no independent set in with strictly more vertices. Given a specific kind of connected graph , find the size of a maximum independent set of .
Giriş formatı
• The input starts with one line, containing integers (), the number of vertices in the graph, and (), the number of edges in the graph.
• Then follow lines, each containing integers () indicating that there is an edge between vertices and .
The graph given by this input is guaranteed to be both 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.
Çıxış formatı
• Output the number of vertices in a maximum independent set of the input graph.
Qeyd
Source: Benelux Algorithm Programming Contest 2019 · Author: Timon Knigge · License: CC BY-SA 4.0 · Original: https://bapc.eu · Statement adapted for AlgoLens and shared under the same license.
Nümunələr
Giriş #1
2 1 1 2
Çıxış #1
1
Giriş #2
4 5 1 2 2 3 3 4 4 1 1 3
Çıxış #2
2