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

34286번 - Accomplices 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB20171583.333%

문제

Your friend Alex is a master of pranks and has been scheming his magnum opus prank: a prank so elaborate that it requires an entire team of accomplices. However, to maintain secrecy, X has imposed a strict condition:

  • No two recruited accomplices can be friends with each other.

This way, if one of them is caught, they cannot directly expose any of the others.

You have been tasked with analyzing all possible ways to recruit a group of accomplices while ensuring this condition is met. Specifically, Alex wants to know how many distinct ways there are to form such groups of different sizes.

You are given a set of $n$ candidates numbered 1ドル$ through $n,ドル along with a list of friendships between them. Each friendship is bidirectional—if candidate $a$ is friends with candidate $b,ドル then candidate $b$ is also friends with candidate $a$.

Your job is to determine, for each possible group size from 0ドル$ to $n$ the number of ways to form such a group while satisfying X's constraint.

입력

The first line contains two integers $n$ and $m$ $(1 \leq n \leq 20,ドル 0ドル \leq m \leq \frac{n(n-1)}{2})$---the number of candidates and the number of friendships.

Each of the next $m$ lines contains two integers $a$ and $ b $ $(1 \leq a, b \leq n,ドル $ a \neq b),ドル indicating that candidates $a$ and $b$ are friends. There are no duplicate friendships.

출력

Print $n+1$ integers on a single line, where the $i$-th integer represents the number of ways to form a valid group of exactly $i-1$ accomplices.

제한

예제 입력 1

5 3
1 2
2 3
4 5

예제 출력 1

1 5 7 2 0 0

We can denote a group of candidates as a list like $[1,2,4],ドル representing the group of candidates 1ドル,ドル 2ドル,ドル and 4ドル$. In the first sample, this list is not a valid group for the prank because candidates 1ドル$ and 2ドル$ are friends. The groups for the sample are as follows.

  • With 0ドル$ accomplices there is 1ドル$ way to select a group: $[]$.
  • With 1ドル$ accomplice there are 5ドル$ ways to select a group: $[1],ドル $[2],ドル $[3],ドル $[4],ドル and $[5]$.
  • With 2ドル$ accomplices there are 7ドル$ ways to select a group: $[1,3],ドル $[1,4],ドル $[1,5],ドル $[2,4],ドル $[2,5],ドル $[3,4],ドル and $[3,4]$.
  • With 3ドル$ accomplices there are 2ドル$ ways to select a group: $[1,3,4],ドル and $[1,3,5]$.
  • With 4ドル$ accomplices it is impossible to select a group where no two candidates are friends.
  • With 5ドル$ accomplices it is impossible to select a group where no two candidates are friends.

힌트

출처

School > CS@Mines > CS@Mines HSPC 2025 F번

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

출처

대학교 대회

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

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