第四回日本最強プログラマー学生選手権-予選-(AtCoder Beginner Contest 313)
翻译中…
Problem Statement
翻译中…
There are $N$ plates numbered $1$ through $N$. Dish $i$ has $a_i$ stones on it. There is also an empty bag.
You can perform the following two kinds of operations any number of times (possibly zero) in any order.
翻译中…
- Remove one stone from each plate with one or more stones. Put the removed stones into the bag.
- Take
$N$stones out of the bag, and put one stone to each plate. This operation can be performed only when the bag has$N$or more stones.
翻译中…
Let $b_i$ be the number of stones on plate $i$ after you finished the operations. Print the number, modulo $998244353$, of sequences of integers $(b_1, b_2, \dots, b_N)$ of length $N$ that can result from the operations.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 2 \times 10^5$$0 \leq a_i \leq 10^9$
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N
a_1 a_2 \dots a_N
翻译中…
Output
翻译中…
Print the number, modulo $998244353$, of possible sequences $(b_1, b_2, \dots, b_N)$.
翻译中…
样例
Input #1
3
3 1 3
Output #1
7
For example, $b$ becomes $(2, 1, 2)$ by the following procedure.
- Perform the first operation. $b$ becomes $(2, 0, 2)$.
- Perform the first operation. $b$ becomes $(1, 0, 1)$.
- Perform the second operation. $b$ becomes $(2, 1, 2)$.
The following seven sequences can be the resulting $b$.
- $(0, 0, 0)$
- $(1, 0, 1)$
- $(1, 1, 1)$
- $(2, 0, 2)$
- $(2, 1, 2)$
- $(2, 2, 2)$
- $(3, 1, 3)$
Input #2
1
0
Output #2
1
There are one sequence, $(0)$, that can be the resulting $b$.
Input #3
5
1 3 5 7 9
Output #3
36
Input #4
10
766294629 440423913 59187619 725560240 585990756 965580535 623321125 550925213 122410708 549392044
Output #4
666174028
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。