AtCoder Regular Contest 117
翻译中…
Problem Statement
翻译中…
There are $N$ buildings along AtCoder road. Initially, the $i$-th building from the left has $A_i$ stories.
翻译中…
Takahashi, the president of ARC Wrecker, Inc., can do the following operation any number of times, possibly zero:
翻译中…
- Choose a positive integer
$X$that he likes and shoot a cannonball at that height, which decreases by$1$the number of stories in each building with$X$or more stories.
翻译中…
Find the number of possible final sceneries of buildings, modulo ($10^{9} + 7$).
翻译中…
We consider two sceneries A and B different when the following holds:
翻译中…
- let
$P_i$be the number of stories of the$i$-th building from the left in scenery A; - let
$Q_i$be the number of stories of the$i$-th building from the left in scenery B; - we consider sceneries A and B different when
$P_i \neq Q_i$for one or more indices$i$.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 100000$$1 \leq A_i \leq 10^{9}$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
A_1 A_2 \cdots A_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
2
1 2
Output #1
4
There are four possible combinations of heights of the buildings, as follows:
- (Building $1$, Building $2$) = $(0, 0)$
- (Building $1$, Building $2$) = $(0, 1)$
- (Building $1$, Building $2$) = $(1, 1)$
- (Building $1$, Building $2$) = $(1, 2)$
Input #2
6
5 3 4 1 5 2
Output #2
32
Input #3
7
314 159 265 358 979 323 846
Output #3
492018656
There are $20192492160000$ possible final sceneries. The correct output is that number modulo $10^{9} + 7$, which is $492018656$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。