시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
7 초 | 1024 MB | 7 | 6 | 4 | 80.000% |
You are given an integer sequence $A_1,A_2,\ldots,A_N$. You'll make a rooted tree with $N$ vertices numbered from $1$ through $N$. The vertex $1$ is the root, and for each vertex $i$ ($2 \leq i \leq N$), its parent $p_i$ must satisfy $p_i<i$.
You define the score of a rooted tree as follows:
There are $(N-1)!$ ways to make a tree. Find the sum of scores of all possible trees, modulo $998244353$.
The first line contains an integer $N$ ($3 \leq N \leq 250000$).
The second line contains integers $A_1,A_2,\ldots,A_N$ ($1 \leq A_i < 998244353$).
Print the answer.
3 2 2 2
12
5 1 2 3 4 5
2080