{"problem":{"name":"Ex - Antichain","description":{"content":"We have a rooted tree $T$ with $N$ vertices numbered $1$ to $N$. Vertex $1$ is the root, and the parent of vertex $i$ $(2 \\leq i \\leq N)$ is vertex $P_i$. A non-empty subset $S$ of the vertex set $V =","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":8000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc269_h"},"statements":[{"statement_type":"Markdown","content":"We have a rooted tree $T$ with $N$ vertices numbered $1$ to $N$. Vertex $1$ is the root, and the parent of vertex $i$ $(2 \\leq i \\leq N)$ is vertex $P_i$.\nA non-empty subset $S$ of the vertex set $V = \\lbrace 1, 2,\\dots, N\\rbrace$ of $T$ is said to be a **good vertex set** when it satisfies the following condition.\n\n*   For every pair of different vertices $(u, v)$ in $S$, the following holds: $u$ is not an ancestor of $v$.\n\nFor each $K = 1, 2, \\dots, N$, find the number, modulo $998244353$, of good vertex sets with exactly $K$ vertices.\n\n## Constraints\n\n*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq P_i \\lt i$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$P_2$ $P_3$ $\\dots$ $P_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc269_h","tags":[],"sample_group":[["4\n1 2 1","4\n2\n0\n0\n\nFor each $1 \\leq K \\leq N$, the good vertex sets of size $K$ are listed below.\n\n*   $K=1$: $\\lbrace 1 \\rbrace, \\lbrace 2 \\rbrace, \\lbrace 3 \\rbrace, \\lbrace 4 \\rbrace$.\n*   $K=2$: $\\lbrace 2, 4 \\rbrace, \\lbrace 3, 4 \\rbrace$.\n*   $K=3,4$: There is none."],["6\n1 1 2 2 5","6\n6\n2\n0\n0\n0"],["6\n1 1 1 1 1","6\n10\n10\n5\n1\n0"],["10\n1 2 1 2 1 1 2 6 9","10\n30\n47\n38\n16\n3\n0\n0\n0\n0"]],"created_at":"2026-03-03 11:01:14"}}