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

24762번 - Ticket Completed? 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB85604262.687%

문제

Many are familiar with the board game Ticket To Ride (Ticket To Ride is copyrighted by Days of Wonder, Inc.) where players compete to build a railway empire, claiming routes between cities. The game consists of a map of cities and various rail segments each connecting two adjacent cities.

A key way to score points towards winning the game is to complete Destination Tickets. Each ticket specifies two distinct cities. A player earns the points that are indicated on the ticket if they have claimed one or more rail segments that form a path connecting the two cities.

There is one ticket for each distinct unordered pair of cities. In our version of the game, each player is randomly given a ticket and they have an equal probability of receiving any ticket. Given a list of rail segments you have already claimed, determine the probability you earn points from the ticket you are given.

입력

The first line of input contains two integers $N$ (2ドル \leq N \leq 10^5$), which is the number of cities, and $M$ (0ドル \leq M \leq 10^6$), which is the number of rail segments you have claimed.

The next $M$ lines describe your claimed rail segments. Each line contains two distinct integers $i$ (1ドル \leq i \leq N$) and $j$ (1ドル \leq j \leq N$), which are the cities that this rail segment connects.

출력

Display the probability you earn points from the ticket you are given.

Your answer should have an absolute error of at most 10ドル^{-6}$.

제한

예제 입력 1

4 2
1 2
3 4

예제 출력 1

0.33333333333333333333

예제 입력 2

5 4
1 5
2 3
2 4
3 4

예제 출력 2

0.4

예제 입력 3

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

예제 출력 3

0.42857142857142857143

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2021 Rocky Mountain Regional Contest L번

  • 문제를 만든 사람: Ryan Farrell
(追記) (追記ここまで)

출처

대학교 대회

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

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