Connected Permutations

4.5

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

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.

実行速度: 5
メモリ制限: 256
ソース制限:
説明

(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.

Editor Image

?