QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#3699. Vertex Cover

Statistics

frog has a graph with $n$ vertices $v(1), v(2), \dots, v(n)$ and $m$ edges $(v(a_1), v(b_1)), (v(a_2), v(b_2)), \dots, (v(a_m), v(b_m))$.

She would like to color some vertices so that each edge has at least one colored vertex.

Find the minimum number of colored vertices.

Input

The input consists of multiple tests. For each test:

The first line contains $2$ integers $n, m$ ($2 \leq n \leq 500, 1 \leq m \leq \frac{n(n - 1)}{2}$). Each of the following $m$ lines contains $2$ integers $a_i, b_i$ ($1 \leq a_i, b_i \leq n, a_i \neq b_i, \min\{a_i, b_i\} \leq 30$)

Output

For each test, write $1$ integer which denotes the minimum number of colored vertices.

Sample Input

3 2
1 2
1 3
6 5
1 2
1 3
1 4
2 5
2 6

Sample Output

1
2

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.