Accomplices

시간 제한2초메모리 제한2048 MB

요약
사람 수 n이 20 이하이고 친구 관계가 주어질 때, 크기 0부터 n까지 각 크기의 독립 집합 개수를 구한다.
난이도

보통10점 중 6점

유형
동적 계획법, 비트 연산, 완전 탐색, 조합론
정답자
아직 제출이 없습니다

문제

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 nn candidates numbered 11 through nn, along with a list of friendships between them. Each friendship is bidirectional—if candidate aa is friends with candidate bb, then candidate bb is also friends with candidate aa.

Your job is to determine, for each possible group size from 00 to nn the number of ways to form such a group while satisfying X's constraint.

입력

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

Each of the next mm lines contains two integers aa and bb (1≤a,b≤n(1 \leq a, b \leq n, a≠b) a \neq b), indicating that candidates aa and bb are friends. There are no duplicate friendships.

출력

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

예제1

  1. 예제 1

    입력
    5 3
    1 2
    2 3
    4 5
    
    예상 출력
    1 5 7 2 0 0