第二回 AtCoder Japan Open -予選- (AtCoder Regular Contest 207 (Div.1))
翻译中…
Problem Statement
翻译中…
Snuke the wizard has $N$ magical lamps numbered $1$ to $N$. The cost of the $i$-th lamp is $a_i$. Initially, none of the lamps are lit.
翻译中…
Snuke has an integer value called MP, which is initially $X$. When Snuke lights a lamp with cost $x$, his MP decreases by $x$. Each time Snuke lights one lamp, the cost of all lamps with cost at least $1$ decreases by $1$.
翻译中…
There are $N!$ possible orders to light the lamps. Find the number, modulo $998244353$, of such orders where MP never becomes negative.
翻译中…
Constraints
翻译中…
$1 \le N \le 100$$0 \le a_i \le 10^{9}$$0 \le X \le 10^9$- All input values are integers.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N X
a_1 a_2 \dots a_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
3 1
0 1 2
Output #1
3
We explain one order where MP never becomes negative.
- First, light lamp $1$. MP decreases by $0$.
- Next, light lamp $3$. MP decreases by $1$.
- Finally, light lamp $2$. MP decreases by $0$.
Note that the cost of a lamp never becomes negative.
Input #2
6 8
2 1 4 8 1 4
Output #2
176
Input #3
20 50
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Output #3
63942667
Do not forget to find the remainder modulo $998244353$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。