AtCoder Regular Contest 148
翻译中…
Problem Statement
翻译中…
You are given a sequence of length $N$, $A = (A_1, ..., A_N)$, and an integer $K$.
How many permutations of $A$ are there such that no two adjacent elements sum to less than $K$? Find the count modulo $998244353$.
翻译中…
Constraints
翻译中…
$2 \leq N \leq 2 \times 10^5$$0 \leq K \leq 10^9$$0 \leq A_i \leq 10^9$- All values in the input are integers.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N K
A_1 A_2 \dots A_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
4 5
1 2 3 4
Output #1
4
The following four permutations satisfy the condition:
- $(1, 4, 2, 3)$
- $(1, 4, 3, 2)$
- $(2, 3, 4, 1)$
- $(3, 2, 4, 1)$
Input #2
4 3
1 2 3 3
Output #2
12
There are $12$ permutations of $A$, all of which satisfy the condition.
Input #3
10 7
3 1 4 1 5 9 2 6 5 3
Output #3
108
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。