

Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 点
問題文
自己ループと二重辺を含まない 頂点 辺の無向連結グラフが与えられます。
番目の辺は頂点 と頂点 を結びます。
グラフから辺を取り除いたとき、グラフ全体が非連結になるような辺のことを橋と呼びます。
与えられた 本のうち橋である辺の本数を求めてください。
ノート
- 自己ループ とは、 であるような辺 のことをいいます。
- 二重辺 とは、 かつ であるような辺の組 のことをいいます。
- 無向グラフが 連結 であるとは、グラフの任意の二頂点間に経路が存在することをいいます。
制約
- 与えられるグラフは自己ループと二重辺を含まない。
- 与えられるグラフは連結である。
入力
入力は以下の形式で標準入力から与えられる。
出力
本の辺のうち、橋である辺の本数を出力せよ。
入力例 1Copy
7 7 1 3 2 7 3 4 4 5 4 6 5 6 6 7
出力例 1Copy
4
与えられるグラフは以下の図で表されます。

図の赤い辺が橋であり、その数は 本です。
入力例 2Copy
3 3 1 2 1 3 2 3
出力例 2Copy
0
橋である辺が存在しない場合もあります。
入力例 3Copy
6 5 1 2 2 3 3 4 4 5 5 6
出力例 3Copy
5
全ての辺が橋である場合もあります。
Score : points
Problem Statement
You are given an undirected connected graph with vertices and edges that does not contain self-loops and double edges.
The -th edge connects Vertex and Vertex .
An edge whose removal disconnects the graph is called a bridge.
Find the number of the edges that are bridges among the edges.
Notes
- A self-loop is an edge such that .
- Double edges are a pair of edges such that and .
- An undirected graph is said to be connected when there exists a path between every pair of vertices.
Constraints
- The given graph does not contain self-loops and double edges.
- The given graph is connected.
Input
Input is given from Standard Input in the following format:
Output
Print the number of the edges that are bridges among the edges.
Sample Input 1Copy
7 7 1 3 2 7 3 4 4 5 4 6 5 6 6 7
Sample Output 1Copy
4
The figure below shows the given graph:

The edges shown in red are bridges. There are four of them.
Sample Input 2Copy
3 3 1 2 1 3 2 3
Sample Output 2Copy
0
It is possible that there is no bridge.
Sample Input 3Copy
6 5 1 2 2 3 3 4 4 5 5 6
Sample Output 3Copy
5
It is possible that every edge is a bridge.