Logo
(追記) (追記ここまで)

30653번 - Mostovi 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB247450.000%

문제

When Leonhard Euler resolved the famous Königsberg bridge problem, he had no clue he had discovered a whole new area of mathematics - graph theory!

Unfortunately, the Königsberg bridge problem is far too easy for the programmers of this era, so Euler came up with another problem - the Zagreb bridge problem!

The bridges of Zagreb form a graph with n nodes and m edges where the edges represent the bridges and the nodes represent the riverine islands. The graph is connected, in other words, it’s possible to get from any node to any other by traveling across the edges. Now Euler asked, how many edges are there such that after their removal the graph becomes disconnected?

Again, Euler didn’t know that this problem is also famous today (those damn Codeforces blogs). So the author of this problem decided to give you an even harder one, how many edges are there such that after the removal of the nodes which it connects, the remaining n − 2 nodes become disconnected?

입력

The first line contains integers n and m (4 ≤ n ≤ 100 000, n − 1 ≤ m ≤ 300 000) - the number of nodes and edges respectively.

Each of the next m lines contains integers ai and bi (1 ≤ ai, bi ≤ n) - this means nodes ai and bi are connected with an edge.

There are no loops or multiple edges.

출력

In a single line output the number of edges with the given property.

제한

서브태스크

번호배점제한
113

n ≤ 100, m ≤ 300

217

n ≤ 1 000, m ≤ 3 000

325

n ≤ 1 000

412

m − n ≤ 20

543

No additional constraints.

예제 입력 1

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

예제 출력 1

1

예제 입력 2

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

예제 출력 2

4

힌트

Clarification of the first example:

By removing edge (1, 3) and corresponding nodes 1 and 1, the remaining graph has two connected components, node 2 and node 4. In other words, it is not connected. It is easy to check it is the only edge with this property.

Clarification of the second example:

The edges with the given property are (1, 2), (2, 4), (2, 6) abd (2, 5).

출처

Contest > Croatian Open Competition in Informatics > COCI 2023/2024 > Contest #1 5번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /