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

20723번 - SSB Tournament 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB177777.778%

문제

Aditya is organizing a huge tournament to play the new hit video game Super Slam Battle (SSB). However, rather than the classic 1ドル$ vs 1ドル$ games, he wants to introduce some chaos into the matches by having 3ドル$ players in every game. He has recruited $n$ people to come participate in the tournament. Now, some of the contestants know each other from before so if they are in the same game, they will only play with each other if the competitive rule set is used. If two contestants do not know each other from before, then they will only play with each other if the casual rule set is used. Thus, Aditya realizes that he can only organize a game between 3ドル$ participants if they all knew each other before or if they all did not know each other before. Given $k$ pairs of people that knew each other before the tournament, help Aditya figure out the total number of games that he can organize.

입력

The first line consists of two space-separated integers $n$ and $k,ドル the number of people in the tournament and the number of pairs of people that knew each other before respectively, with 3ドル \leq n \leq 10^6$ and 1ドル \leq k \leq 10^6$. Each of the next $k$ lines contain two space-separated integers $u$ and $v$ (1ドル \leq u,v \leq n$ and $u \neq v$), signifying two people $u$ and $v$ that know each other before the tournament. Each pair $(u, v)$ will be specified at most once.

출력

Print the number of distinct games with 3ドル$ people that Aditya can organize.

제한

예제 입력 1

5 3
1 2
2 3
1 3

예제 출력 1

4

예제 입력 2

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

예제 출력 2

3

힌트

출처

University > UT Invitational Programming Contest > UT Invitational Programming Contest 2020 J번

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

출처

대학교 대회

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

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