201135: [AtCoder]ARC113 F - Social Distance

Memory Limit:1024 MB Time Limit:4 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $1000$ points

Problem Statement

Given is an integer sequence of length $N+1$: $X_0,X_1,\ldots,X_N$, where $0=X_0 < X_1 < \ldots < X_N$ holds.

Now, $N$ people numbered $1$ through $N$ will appear on a number line. Person $i$ will appear at a real coordinate chosen uniformly at random from the interval $[X_{i-1},X_i]$.

Find the expected value of the smallest distance between two people, modulo $998244353$.

Definition of the expected value modulo $998244353$

We can prove that the expected value in question is always a rational number. We can also prove that, under the constraints of this problem, if we express the expected value as an irreducible fraction $\frac{P}{Q}$, we have $Q \neq 0 \pmod{998244353}$. Thus, there uniquely exists an integer $R$ such that $R \times Q \equiv P \pmod{998244353}, 0 \leq R < 998244353$. Report this $R$.

Constraints

  • $2 \leq N \leq 20$
  • $0=X_0 < X_1 < \cdots < X_N \leq 10^6$

Input

Input is given from Standard Input in the following format:

$N$
$X_0$ $X_1$ $\ldots$ $X_N$

Output

Print the expected value of the smallest distance between two people, modulo $998244353$.


Sample Input 1

2
0 1 3

Sample Output 1

499122178

There are just two people, so the expected value of the smallest distance between two people is just the expected value of the distance between Person $1$ and Person $2$. The answer is $3/2$.


Sample Input 2

5
0 3 4 8 9 14

Sample Output 2

324469854

The answer is $196249/172800$.


Sample Input 3

20
0 38927 83112 125409 165053 204085 246405 285073 325658 364254 406395 446145 485206 525532 563762 605769 644863 683453 722061 760345 798556

Sample Output 3

29493181

Input

题意翻译

- 给定一个长为 $n$ 的**递增**序列 $x_0,x_1,\cdots,x_n$,其中 $x_0=0$。 - 对于每个 $1\le i\le n$ 的 $i$,在 $[x_{i-1},x_i]$ 中随机选取一个**实数**作为 $a_i$。 - 求 $\min_{2\le i\le n}a_i-a_{i-1}$ 的期望,答案对 $998244353$ 取模。 - $2\le n\le20$,$x_n\le10^6$。

加入题单

算法标签: