QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100

#16601. Algebra

Statistiques

Construct a tree using the following classic method: for $i = 2 \sim n$, randomly choose a node from $1 \sim i-1$ to be the parent of $i$.

Let $f_u$ be the size of the subtree rooted at node $u$ raised to the power of $k$. For each node $u$, calculate the expected value of $f_u$. Output the results modulo the given prime $M$.

Input

The first line contains three positive integers $n, k, M$.

Output

A single line containing $n$ numbers, representing the answers.

Examples

Input 1

3 1 1000000007

Output 1

3 500000005 1

Input 2

3 2 998244353

Output 2

9 499122179 1

Input 3

10 3 1000000007

Output 3

1000 225 333333416 500000039 714285737 523809537 357142865 83333337 777777785 1

Constraints

It is guaranteed that $1 \le n \le 10^5$, $1 \le k \le 200$, $10^8 \le M \le 10^9 + 7$, and $M$ is a prime number.

Subtasks

  • subtask1(20pts): $n \le 10$.
  • subtask2(20pts): $n \le 100$.
  • subtask3(10pts): $k = 1$.
  • subtask4(10pts): $k = 2$.
  • subtask5(20pts): $k \le 20$.
  • subtask6(20pts): No special properties.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.