Problem F
Accomplices
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
Your job is to determine, for each possible group size from
Input
The first line contains two integers
Each of the next
Output
Print
Sample Explanation
We can denote a group of candidates as a list like
-
With
accomplices there is way to select a group: . -
With
accomplice there are ways to select a group: , , , , and . -
With
accomplices there are ways to select a group: , , , , , , and . -
With
accomplices there are ways to select a group: , and . -
With
accomplices it is impossible to select a group where no two candidates are friends. -
With
accomplices it is impossible to select a group where no two candidates are friends.
Sample Input 1 | Sample Output 1 |
---|---|
5 3 1 2 2 3 4 5 |
1 5 7 2 0 0 |