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

26967번 - Making Friends 다국어

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

문제

There are initially $M$ (1ドル\le M\le 2\cdot 10^5$) pairs of friends among FJ's $N$ (2ドル\le N\le 2\cdot 10^5$) cows labeled 1ドル\dots N$. The cows are leaving the farm for vacation one by one. On day $i,ドル the $i$-th cow leaves the farm, and all pairs of the $i$-th cow's friends still present on the farm become friends. How many new friendships are formed in total?

입력

The first line contains $N$ and $M$.

The next $M$ lines contain two integers $u_i$ and $v_i$ denoting that cows $u_i$ and $v_i$ are friends (1ドル\le u_i,v_i\le N,ドル $u_i\neq v_i$). No unordered pair of cows appears more than once.

출력

One line containing the total number of new friendships formed. Do not include pairs of cows that were already friends at the beginning.

제한

예제 입력 1

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

예제 출력 1

5

힌트

On day 1ドル,ドル three new friendships are formed: $(3,4),ドル $(3,7),ドル and $(4,7)$.

On day 3ドル,ドル two new friendships are formed: $(4,5)$ and $(5,7)$.

출처

Olympiad > USA Computing Olympiad > 2022-2023 Season > USACO 2022 December Contest > Platinum 2번

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

출처

대학교 대회

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

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