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

26971번 - Strongest Friendship Group 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB2971539343.256%

문제

Farmer John has $N$ cows (2ドル\le N\le 10^5$), conveniently labeled 1ドル \ldots N$. There are $M$ (1ドル\le M\le 2\cdot 10^5$) pairs of friends among these cows.

A group of cows is called a "friendship group" if every cow in the group is reachable from every other cow in the group via a chain of friendships that lies solely within the group (friendships connecting to cows outside the group have no impact). The "strength" of a friendship group is the minimum number of friends of any cow in the group within the group times the number of cows in the group (again, note that friendships connecting to cows outside the group do not count for this definition).

Please find the maximum strength over all friendship groups.

입력

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 maximum strength over all friendship groups.

제한

예제 입력 1

8 10
1 2
1 3
1 4
2 3
2 4
3 4
1 5
2 6
3 7
4 8

예제 출력 1

12

힌트

The maximum strength can be observed to be with the group of cows numbered 1,ドル 2, 3, 4$. The minimum number of friends of any cow in this group within the group is 3ドル,ドル so the answer is 4ドル\cdot 3=12$.

출처

Olympiad > USA Computing Olympiad > 2022-2023 Season > USACO 2022 December Contest > Gold 3번

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

출처

대학교 대회

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

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