| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 7 초 | 1024 MB | 33 | 8 | 6 | 21.429% |
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