4 2 1 3
8
After initializing $B = (2, 1, 0, 3)$, it is possible to make $B = A$ using the following steps:
* Choose $(l, r) = (2, 4)$, remove $\mathrm{mex}({1, 0, 3}) = 2$ from $B$, making $B = (1, 0, 3)$.
* Choose $(l, r) = (3, 3)$, remove $\mathrm{mex}({3}) = 0$ from $B$, making $B = (1, 3)$.
Thus, $P = (2, 1, 0, 3)$ satisfies the condition.
There are eight permutations $P$ that satisfy the condition, including the above, so print $8$.4 4 0 3 2 1
1 Only $P = (0, 3, 2, 1)$ satisfies the condition.
16 7 9 2 4 0 1 6 7
3520
92 4 1 67 16 7
726870122 Find the count modulo $998244353$.
{
"problem": {
"name": "Delete Range Mex",
"description": {
"content": "You are given a positive integer $N$ and a sequence of $M$ non-negative integers $A = (A_{1}, A_{2}, \\dots, A_{M})$. Here, all elements of $A$ are distinct integers between $0$ and $N-1$, inclusive. F",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc178_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a positive integer $N$ and a sequence of $M$ non-negative integers $A = (A_{1}, A_{2}, \\dots, A_{M})$.\nHere, all elements of $A$ are distinct integers between $0$ and $N-1$, inclusive.\nF...",
"is_translate": false,
"language": "English"
}
]
}