AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

BAPC19-038.Inquiry II

Medium · 1 s · 256 MB

  • icpc
  • bapc
  • 2019

For an undirected, simple graph G=(V,E)G = (V, E)G=(V,E) we call a subset V′⊆VV' \subseteq VV′⊆V an independent set if no two elements of V′V'V′ are connected by an edge. An independent set of GGG is called a maximum independent set if there is no independent set in GGG with strictly more vertices. Given a specific kind of connected graph GGG, find the size of a maximum independent set of GGG.

Giriş formatı

• The input starts with one line, containing integers nnn (1≤n≤1001 \leq n \leq 1001≤n≤100), the number of vertices in the graph, and mmm (n−1≤m≤n+15n-1 \leq m \leq n + 15n−1≤m≤n+15), the number of edges in the graph.

• Then follow mmm lines, each containing integers a,ba, ba,b (1≤a,b≤n1 \leq a, b \leq n1≤a,b≤n) indicating that there is an edge between vertices aaa and bbb.

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