luogu#P5241. 序列

    ID: 4209 远端评测题 1000~3500ms 1000MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划 DP贪心强连通分量洛谷月赛

序列

Problem Description

Build a directed graph GG with NN vertices, with no edges at the beginning.

Next, build an edge sequence AA of length EE. Each edge in the sequence is a directed edge (s,t)(s,t) satisfying 1s,tN1 \le s,t \le N and sts \ne t, and all edges in the sequence are distinct.

Add these edges to GG in order. After each addition, compute and record the current number of strongly connected components in the graph, obtaining a new positive integer sequence BB of length EE.

  • If two edge sequences produce the same BB, then they are called essentially the same.

How many essentially different edge sequences are there? You only need to output the answer modulo 109+710^9+7.

Input Format

Input one line containing a positive integer NN, which denotes the number of vertices in the directed graph GG.

Output Format

Output one line containing N×(N1)N \times (N-1) integers separated by spaces. The ii-th number represents the answer when E=iE=i.

3

1 2 4 7 7 7

Hint

Subtask 1 (5pts): N5N \le 5.

Subtask 2 (10pts): N10N \le 10.

Subtask 3 (15pts): N20N \le 20.

Subtask 4 (15pts): N30N \le 30.

Subtask 5 (15pts): N50N \le 50.

Subtask 6 (20pts): N100N \le 100.

Subtask 7 (20pts): No special constraints.

Constraints: For all data, N400N \le 400.

For the first 66 subtasks, the time limit is 1s1\text s, and for the 77-th it is 3.5s3.5\text s.

Code length limit: 10kb. If it exceeds this limit, it will be marked as invalid after the contest.

Translated by ChatGPT 5