Connected Permutations

4.5

2 votes
Algorithms, Approved, Combinatorics, Fast Fourier transform, Hard, generating-functions
Problem

We say that permutation p of size n is connected if there is no k, 1k<n, such that p(1),p(2),,p(k) is permutation of 1,2,,k.
You are given a positive integer n. Find out number of connected permutations of size 1,2,,n. As this numbers can be large, print them modulo 924844033.

Input Format:
Single line containing integer n.

Output Format:
Output n lines, numbers of connected permutations of size 1,2,,n.

Constraints:
1n500,000.

50 points
n5,000.

Sample Input
3
Sample Output
1
1
3
Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

(1) is connected permutation.
(2, 1) is connected permutation, (1, 2) is not.
(2, 3, 1), (3, 1, 2), (3, 2, 1) are connected permutations, (1, 2, 3), (1, 3, 2), (2, 1, 3) are not.

Contributers:
Editor Image

?