atcoder#ARC117B. [ARC117B] ARC Wrecker
[ARC117B] ARC Wrecker
Score : points
Problem Statement
There are buildings along AtCoder road. Initially, the -th building from the left has stories.
Takahashi, the president of ARC Wrecker, Inc., can do the following operation any number of times, possibly zero:
- Choose a positive integer that he likes and shoot a cannonball at that height, which decreases by the number of stories in each building with or more stories.
Find the number of possible final sceneries of buildings, modulo ().
We consider two sceneries A and B different when the following holds:
- let be the number of stories of the -th building from the left in scenery A;
- let be the number of stories of the -th building from the left in scenery B;
- we consider sceneries A and B different when for one or more indices .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2
1 2
4
There are four possible combinations of heights of the buildings, as follows:
- (Building , Building ) =
- (Building , Building ) =
- (Building , Building ) =
- (Building , Building ) =
6
5 3 4 1 5 2
32
7
314 159 265 358 979 323 846
492018656
There are possible final sceneries. The correct output is that number modulo , which is .