#591
Unrated
Making Friends
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Note: the time limit for this problem is 3s, 50% larger than the default. The memory limit is twice the default.

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

입력

The first line contains NN and MM.

The next MM lines contain two integers uiu_i and viv_i denoting that cows uiu_i and viv_i are friends (1ui,viN1\le u_i,v_i\le N, uiviu_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

점수

Test cases 2-3 satisfy N500N\le 500.Test cases 4-7 satisfy N104N\le 10^4.Test cases 8-17 satisfy no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.