AtCoder Beginner Contest 209
翻译中…
Problem Statement
翻译中…
You are given a sequence $C$ of $N$ integers. Find the number of sequences $A$ of $N$ integers satisfying all of the following conditions.
翻译中…
$1 \leq A_i \leq C_i\, (1 \leq i \leq N)$$A_i \neq A_j\, (1 \leq i < j \leq N)$
翻译中…
Since the count may be enormous, print it modulo $(10^9+7)$.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 2 \times 10^5$$1 \leq C_i \leq 10^9$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
C_1 C_2 \ldots C_N
翻译中…
Output
翻译中…
Print the number of sequences $A$ of $N$ integers satisfying all of the following conditions, modulo $(10^9+7)$.
翻译中…
样例
Input #1
2
1 3
Output #1
2
We have two sequences $A$ satisfying all of the conditions: $(1,2)$ and $(1,3)$.
On the other hand, $A=(1,1)$, for example, does not satisfy the second condition.
Input #2
4
3 3 4 4
Output #2
12
Input #3
2
1 1
Output #3
0
We have no sequences $A$ satisfying all of the conditions, so we should print $0$.
Input #4
10
999999917 999999914 999999923 999999985 999999907 999999965 999999914 999999908 999999951 999999979
Output #4
405924645
Be sure to print the count modulo $(10^9+7)$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。