#P1636. Einstein学画画

Einstein学画画

Description

Einstein has started learning to draw.

He is rather lazy, and he hopes to draw a picture using as few strokes as possible.

Given an undirected graph with nn vertices (numbered 1n1 \sim n) and mm edges, find the minimum number of strokes needed to draw all the edges in the graph.

Input Format

The first line contains two integers n,mn, m.

Each of the next mm lines contains two integers a,ba, b (aba \ne b), indicating that there is an edge between vertices aa and bb.

No edge is described more than once.

Output Format

A single integer, i.e., the answer.

5 5
2 3
2 4
2 5
3 4
4 5

1

Hint

For 50%50\% of the testdata, n50n \le 50, m100m \le 100.

For 100%100\% of the testdata, 1n10001 \le n \le 1000, 1m1051 \le m \le {10}^5.

Translated by ChatGPT 5